031eff2932c3edf3ad690d1e3abe2dde.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. ace.define("ace/mode/pascal_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 PascalHighlightRules = function () {
  5. var keywordMapper = this.createKeywordMapper({
  6. "keyword.control": "absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class" +
  7. "|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization" +
  8. "|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is" +
  9. "|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private" +
  10. "|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr" +
  11. "|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor"
  12. }, "identifier", true);
  13. this.$rules = {
  14. start: [{
  15. caseInsensitive: true,
  16. token: ['variable', "text",
  17. 'storage.type.prototype',
  18. 'entity.name.function.prototype'
  19. ],
  20. regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))'
  21. }, {
  22. caseInsensitive: true,
  23. token: ['variable', "text", 'storage.type.function', 'entity.name.function'],
  24. regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?'
  25. }, {
  26. caseInsensitive: true,
  27. token: keywordMapper,
  28. regex: /\b[a-z_]+\b/
  29. }, {
  30. token: 'constant.numeric',
  31. regex: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b'
  32. }, {
  33. token: 'punctuation.definition.comment',
  34. regex: '--.*$'
  35. }, {
  36. token: 'punctuation.definition.comment',
  37. regex: '//.*$'
  38. }, {
  39. token: 'punctuation.definition.comment',
  40. regex: '\\(\\*',
  41. push: [{
  42. token: 'punctuation.definition.comment',
  43. regex: '\\*\\)',
  44. next: 'pop'
  45. },
  46. { defaultToken: 'comment.block.one' }
  47. ]
  48. }, {
  49. token: 'punctuation.definition.comment',
  50. regex: '\\{',
  51. push: [{
  52. token: 'punctuation.definition.comment',
  53. regex: '\\}',
  54. next: 'pop'
  55. },
  56. { defaultToken: 'comment.block.two' }
  57. ]
  58. }, {
  59. token: 'punctuation.definition.string.begin',
  60. regex: '"',
  61. push: [{ token: 'constant.character.escape', regex: '\\\\.' },
  62. {
  63. token: 'punctuation.definition.string.end',
  64. regex: '"',
  65. next: 'pop'
  66. },
  67. { defaultToken: 'string.quoted.double' }
  68. ]
  69. }, {
  70. token: 'punctuation.definition.string.begin',
  71. regex: '\'',
  72. push: [{
  73. token: 'constant.character.escape.apostrophe',
  74. regex: '\'\''
  75. },
  76. {
  77. token: 'punctuation.definition.string.end',
  78. regex: '\'',
  79. next: 'pop'
  80. },
  81. { defaultToken: 'string.quoted.single' }
  82. ]
  83. }, {
  84. token: 'keyword.operator',
  85. regex: '[+\\-;,/*%]|:=|='
  86. }
  87. ]
  88. };
  89. this.normalizeRules();
  90. };
  91. oop.inherits(PascalHighlightRules, TextHighlightRules);
  92. exports.PascalHighlightRules = PascalHighlightRules;
  93. });
  94. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  95. var oop = require("../../lib/oop");
  96. var BaseFoldMode = require("./fold_mode").FoldMode;
  97. var Range = require("../../range").Range;
  98. var FoldMode = exports.FoldMode = function () { };
  99. oop.inherits(FoldMode, BaseFoldMode);
  100. (function () {
  101. this.getFoldWidgetRange = function (session, foldStyle, row) {
  102. var range = this.indentationBlock(session, row);
  103. if (range)
  104. return range;
  105. var re = /\S/;
  106. var line = session.getLine(row);
  107. var startLevel = line.search(re);
  108. if (startLevel == -1 || line[startLevel] != "#")
  109. return;
  110. var startColumn = line.length;
  111. var maxRow = session.getLength();
  112. var startRow = row;
  113. var endRow = row;
  114. while (++row < maxRow) {
  115. line = session.getLine(row);
  116. var level = line.search(re);
  117. if (level == -1)
  118. continue;
  119. if (line[level] != "#")
  120. break;
  121. endRow = row;
  122. }
  123. if (endRow > startRow) {
  124. var endColumn = session.getLine(endRow).length;
  125. return new Range(startRow, startColumn, endRow, endColumn);
  126. }
  127. };
  128. this.getFoldWidget = function (session, foldStyle, row) {
  129. var line = session.getLine(row);
  130. var indent = line.search(/\S/);
  131. var next = session.getLine(row + 1);
  132. var prev = session.getLine(row - 1);
  133. var prevIndent = prev.search(/\S/);
  134. var nextIndent = next.search(/\S/);
  135. if (indent == -1) {
  136. session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
  137. return "";
  138. }
  139. if (prevIndent == -1) {
  140. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  141. session.foldWidgets[row - 1] = "";
  142. session.foldWidgets[row + 1] = "";
  143. return "start";
  144. }
  145. }
  146. else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  147. if (session.getLine(row - 2).search(/\S/) == -1) {
  148. session.foldWidgets[row - 1] = "start";
  149. session.foldWidgets[row + 1] = "";
  150. return "";
  151. }
  152. }
  153. if (prevIndent != -1 && prevIndent < indent)
  154. session.foldWidgets[row - 1] = "start";
  155. else
  156. session.foldWidgets[row - 1] = "";
  157. if (indent < nextIndent)
  158. return "start";
  159. else
  160. return "";
  161. };
  162. }).call(FoldMode.prototype);
  163. });
  164. ace.define("ace/mode/pascal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/pascal_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module){/*
  165. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  166. */
  167. "use strict";
  168. var oop = require("../lib/oop");
  169. var TextMode = require("./text").Mode;
  170. var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules;
  171. var FoldMode = require("./folding/coffee").FoldMode;
  172. var Mode = function () {
  173. this.HighlightRules = PascalHighlightRules;
  174. this.foldingRules = new FoldMode();
  175. this.$behaviour = this.$defaultBehaviour;
  176. };
  177. oop.inherits(Mode, TextMode);
  178. (function () {
  179. this.lineCommentStart = ["--", "//"];
  180. this.blockComment = [
  181. { start: "(*", end: "*)" },
  182. { start: "{", end: "}" }
  183. ];
  184. this.$id = "ace/mode/pascal";
  185. }).call(Mode.prototype);
  186. exports.Mode = Mode;
  187. }); (function() {
  188. ace.require(["ace/mode/pascal"], function(m) {
  189. if (typeof module == "object" && typeof exports == "object" && module) {
  190. module.exports = m;
  191. }
  192. });
  193. })();