e57143ce0fcc3e3a435d5ef13d0353a1.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ace.define("ace/mode/eiffel_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var EiffelHighlightRules = function () {
  5. var keywords = "across|agent|alias|all|attached|as|assign|attribute|check|" +
  6. "class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
  7. "ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
  8. "inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
  9. "Precursor|redefine|rename|require|rescue|retry|select|separate|" +
  10. "some|then|undefine|until|variant|when";
  11. var operatorKeywords = "and|implies|or|xor";
  12. var languageConstants = "Void";
  13. var booleanConstants = "True|False";
  14. var languageVariables = "Current|Result";
  15. var keywordMapper = this.createKeywordMapper({
  16. "constant.language": languageConstants,
  17. "constant.language.boolean": booleanConstants,
  18. "variable.language": languageVariables,
  19. "keyword.operator": operatorKeywords,
  20. "keyword": keywords
  21. }, "identifier", true);
  22. var simpleString = /(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)+?/;
  23. this.$rules = {
  24. "start": [{
  25. token: "string.quoted.other",
  26. regex: /"\[/,
  27. next: "aligned_verbatim_string"
  28. }, {
  29. token: "string.quoted.other",
  30. regex: /"\{/,
  31. next: "non-aligned_verbatim_string"
  32. }, {
  33. token: "string.quoted.double",
  34. regex: /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/
  35. }, {
  36. token: "comment.line.double-dash",
  37. regex: /--.*/
  38. }, {
  39. token: "constant.character",
  40. regex: /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/
  41. }, {
  42. token: "constant.numeric",
  43. regex: /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/
  44. }, {
  45. token: "constant.numeric",
  46. regex: /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/
  47. }, {
  48. token: "paren.lparen",
  49. regex: /[\[({]|<<|\|\(/
  50. }, {
  51. token: "paren.rparen",
  52. regex: /[\])}]|>>|\|\)/
  53. }, {
  54. token: "keyword.operator",
  55. regex: /:=|->|\.(?=\w)|[;,:?]/
  56. }, {
  57. token: "keyword.operator",
  58. regex: /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/
  59. }, {
  60. token: function (v) {
  61. var result = keywordMapper(v);
  62. if (result === "identifier" && v === v.toUpperCase()) {
  63. result = "entity.name.type";
  64. }
  65. return result;
  66. },
  67. regex: /[a-zA-Z][a-zA-Z\d_]*\b/
  68. }, {
  69. token: "text",
  70. regex: /\s+/
  71. }
  72. ],
  73. "aligned_verbatim_string": [{
  74. token: "string",
  75. regex: /]"/,
  76. next: "start"
  77. }, {
  78. token: "string",
  79. regex: simpleString
  80. }
  81. ],
  82. "non-aligned_verbatim_string": [{
  83. token: "string.quoted.other",
  84. regex: /}"/,
  85. next: "start"
  86. }, {
  87. token: "string.quoted.other",
  88. regex: simpleString
  89. }
  90. ]
  91. };
  92. };
  93. oop.inherits(EiffelHighlightRules, TextHighlightRules);
  94. exports.EiffelHighlightRules = EiffelHighlightRules;
  95. });
  96. ace.define("ace/mode/eiffel",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/eiffel_highlight_rules"], function(require, exports, module){"use strict";
  97. var oop = require("../lib/oop");
  98. var TextMode = require("./text").Mode;
  99. var EiffelHighlightRules = require("./eiffel_highlight_rules").EiffelHighlightRules;
  100. var Mode = function () {
  101. this.HighlightRules = EiffelHighlightRules;
  102. this.$behaviour = this.$defaultBehaviour;
  103. };
  104. oop.inherits(Mode, TextMode);
  105. (function () {
  106. this.lineCommentStart = "--";
  107. this.$id = "ace/mode/eiffel";
  108. }).call(Mode.prototype);
  109. exports.Mode = Mode;
  110. }); (function() {
  111. ace.require(["ace/mode/eiffel"], function(m) {
  112. if (typeof module == "object" && typeof exports == "object" && module) {
  113. module.exports = m;
  114. }
  115. });
  116. })();