mode-eiffel.js 5.2 KB

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