ab97e619322ba5f39d521ef73502cf48.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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.commentBlock = function (session, row) {
  102. var re = /\S/;
  103. var line = session.getLine(row);
  104. var startLevel = line.search(re);
  105. if (startLevel == -1 || line[startLevel] != "#")
  106. return;
  107. var startColumn = line.length;
  108. var maxRow = session.getLength();
  109. var startRow = row;
  110. var endRow = row;
  111. while (++row < maxRow) {
  112. line = session.getLine(row);
  113. var level = line.search(re);
  114. if (level == -1)
  115. continue;
  116. if (line[level] != "#")
  117. break;
  118. endRow = row;
  119. }
  120. if (endRow > startRow) {
  121. var endColumn = session.getLine(endRow).length;
  122. return new Range(startRow, startColumn, endRow, endColumn);
  123. }
  124. };
  125. this.getFoldWidgetRange = function (session, foldStyle, row) {
  126. var range = this.indentationBlock(session, row);
  127. if (range)
  128. return range;
  129. range = this.commentBlock(session, row);
  130. if (range)
  131. return range;
  132. };
  133. this.getFoldWidget = function (session, foldStyle, row) {
  134. var line = session.getLine(row);
  135. var indent = line.search(/\S/);
  136. var next = session.getLine(row + 1);
  137. var prev = session.getLine(row - 1);
  138. var prevIndent = prev.search(/\S/);
  139. var nextIndent = next.search(/\S/);
  140. if (indent == -1) {
  141. session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
  142. return "";
  143. }
  144. if (prevIndent == -1) {
  145. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  146. session.foldWidgets[row - 1] = "";
  147. session.foldWidgets[row + 1] = "";
  148. return "start";
  149. }
  150. }
  151. else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  152. if (session.getLine(row - 2).search(/\S/) == -1) {
  153. session.foldWidgets[row - 1] = "start";
  154. session.foldWidgets[row + 1] = "";
  155. return "";
  156. }
  157. }
  158. if (prevIndent != -1 && prevIndent < indent)
  159. session.foldWidgets[row - 1] = "start";
  160. else
  161. session.foldWidgets[row - 1] = "";
  162. if (indent < nextIndent)
  163. return "start";
  164. else
  165. return "";
  166. };
  167. }).call(FoldMode.prototype);
  168. });
  169. 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){/*
  170. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  171. */
  172. "use strict";
  173. var oop = require("../lib/oop");
  174. var TextMode = require("./text").Mode;
  175. var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules;
  176. var FoldMode = require("./folding/coffee").FoldMode;
  177. var Mode = function () {
  178. this.HighlightRules = PascalHighlightRules;
  179. this.foldingRules = new FoldMode();
  180. this.$behaviour = this.$defaultBehaviour;
  181. };
  182. oop.inherits(Mode, TextMode);
  183. (function () {
  184. this.lineCommentStart = ["--", "//"];
  185. this.blockComment = [
  186. { start: "(*", end: "*)" },
  187. { start: "{", end: "}" }
  188. ];
  189. this.$id = "ace/mode/pascal";
  190. }).call(Mode.prototype);
  191. exports.Mode = Mode;
  192. }); (function() {
  193. ace.require(["ace/mode/pascal"], function(m) {
  194. if (typeof module == "object" && typeof exports == "object" && module) {
  195. module.exports = m;
  196. }
  197. });
  198. })();