8abeef6a68ee08e5bf12281dec186e2c.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ace.define("ace/mode/ada_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 AdaHighlightRules = function () {
  5. var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" +
  6. "access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" +
  7. "array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" +
  8. "body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" +
  9. "|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor";
  10. var builtinConstants = ("true|false|null");
  11. var builtinFunctions = ("count|min|max|avg|sum|rank|now|coalesce|main");
  12. var keywordMapper = this.createKeywordMapper({
  13. "support.function": builtinFunctions,
  14. "keyword": keywords,
  15. "constant.language": builtinConstants
  16. }, "identifier", true);
  17. this.$rules = {
  18. "start": [{
  19. token: "comment",
  20. regex: "--.*$"
  21. }, {
  22. token: "string", // " string
  23. regex: '".*?"'
  24. }, {
  25. token: "string", // character
  26. regex: "'.'"
  27. }, {
  28. token: "constant.numeric", // float
  29. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  30. }, {
  31. token: keywordMapper,
  32. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  33. }, {
  34. token: "keyword.operator",
  35. regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
  36. }, {
  37. token: "paren.lparen",
  38. regex: "[\\(]"
  39. }, {
  40. token: "paren.rparen",
  41. regex: "[\\)]"
  42. }, {
  43. token: "text",
  44. regex: "\\s+"
  45. }]
  46. };
  47. };
  48. oop.inherits(AdaHighlightRules, TextHighlightRules);
  49. exports.AdaHighlightRules = AdaHighlightRules;
  50. });
  51. ace.define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"], function(require, exports, module){"use strict";
  52. var oop = require("../lib/oop");
  53. var TextMode = require("./text").Mode;
  54. var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
  55. var Range = require("../range").Range;
  56. var Mode = function () {
  57. this.HighlightRules = AdaHighlightRules;
  58. this.$behaviour = this.$defaultBehaviour;
  59. };
  60. oop.inherits(Mode, TextMode);
  61. (function () {
  62. this.lineCommentStart = "--";
  63. this.getNextLineIndent = function (state, line, tab) {
  64. var indent = this.$getIndent(line);
  65. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  66. var tokens = tokenizedLine.tokens;
  67. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  68. return indent;
  69. }
  70. if (state == "start") {
  71. var match = line.match(/^.*(begin|loop|then|is|do)\s*$/);
  72. if (match) {
  73. indent += tab;
  74. }
  75. }
  76. return indent;
  77. };
  78. this.checkOutdent = function (state, line, input) {
  79. var complete_line = line + input;
  80. if (complete_line.match(/^\s*(begin|end)$/)) {
  81. return true;
  82. }
  83. return false;
  84. };
  85. this.autoOutdent = function (state, session, row) {
  86. var line = session.getLine(row);
  87. var prevLine = session.getLine(row - 1);
  88. var prevIndent = this.$getIndent(prevLine).length;
  89. var indent = this.$getIndent(line).length;
  90. if (indent <= prevIndent) {
  91. return;
  92. }
  93. session.outdentRows(new Range(row, 0, row + 2, 0));
  94. };
  95. this.$id = "ace/mode/ada";
  96. }).call(Mode.prototype);
  97. exports.Mode = Mode;
  98. }); (function() {
  99. ace.require(["ace/mode/ada"], function(m) {
  100. if (typeof module == "object" && typeof exports == "object" && module) {
  101. module.exports = m;
  102. }
  103. });
  104. })();