3cfffbb4555d5856b82186750e7b2b65.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. ace.define("ace/mode/forth_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from https://raw.github.com/vze26m98/Forth.tmbundle/master/Syntaxes/Forth.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var ForthHighlightRules = function () {
  6. this.$rules = { start: [{ include: '#forth' }],
  7. '#comment': [{ token: 'comment.line.double-dash.forth',
  8. regex: '(?:^|\\s)--\\s.*$',
  9. comment: 'line comments for iForth' },
  10. { token: 'comment.line.backslash.forth',
  11. regex: '(?:^|\\s)\\\\[\\s\\S]*$',
  12. comment: 'ANSI line comment' },
  13. { token: 'comment.line.backslash-g.forth',
  14. regex: '(?:^|\\s)\\\\[Gg] .*$',
  15. comment: 'gForth line comment' },
  16. { token: 'comment.block.forth',
  17. regex: '(?:^|\\s)\\(\\*(?=\\s|$)',
  18. push: [{ token: 'comment.block.forth',
  19. regex: '(?:^|\\s)\\*\\)(?=\\s|$)',
  20. next: 'pop' },
  21. { defaultToken: 'comment.block.forth' }],
  22. comment: 'multiline comments for iForth' },
  23. { token: 'comment.block.documentation.forth',
  24. regex: '\\bDOC\\b',
  25. caseInsensitive: true,
  26. push: [{ token: 'comment.block.documentation.forth',
  27. regex: '\\bENDDOC\\b',
  28. caseInsensitive: true,
  29. next: 'pop' },
  30. { defaultToken: 'comment.block.documentation.forth' }],
  31. comment: 'documentation comments for iForth' },
  32. { token: 'comment.line.parentheses.forth',
  33. regex: '(?:^|\\s)\\.?\\( [^)]*\\)',
  34. comment: 'ANSI line comment' }],
  35. '#constant': [{ token: 'constant.language.forth',
  36. regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)',
  37. caseInsensitive: true },
  38. { token: 'constant.numeric.forth',
  39. regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)' },
  40. { token: 'constant.character.forth',
  41. regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)' }],
  42. '#forth': [{ include: '#constant' },
  43. { include: '#comment' },
  44. { include: '#string' },
  45. { include: '#word' },
  46. { include: '#variable' },
  47. { include: '#storage' },
  48. { include: '#word-def' }],
  49. '#storage': [{ token: 'storage.type.forth',
  50. regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)',
  51. caseInsensitive: true }],
  52. '#string': [{ token: 'string.quoted.double.forth',
  53. regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")',
  54. caseInsensitive: true },
  55. { token: 'string.unquoted.forth',
  56. regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)',
  57. caseInsensitive: true }],
  58. '#variable': [{ token: 'variable.language.forth',
  59. regex: '\\b(?:I|J)\\b',
  60. caseInsensitive: true }],
  61. '#word': [{ token: 'keyword.control.immediate.forth',
  62. regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)',
  63. caseInsensitive: true },
  64. { token: 'keyword.other.immediate.forth',
  65. regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)',
  66. caseInsensitive: true },
  67. { token: 'keyword.control.compile-only.forth',
  68. regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)',
  69. caseInsensitive: true },
  70. { token: 'keyword.other.compile-only.forth',
  71. regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)',
  72. caseInsensitive: true },
  73. { token: 'keyword.other.non-immediate.forth',
  74. regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)',
  75. caseInsensitive: true },
  76. { token: 'keyword.other.warning.forth',
  77. regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)',
  78. caseInsensitive: true }],
  79. '#word-def': [{ token: ['keyword.other.compile-only.forth',
  80. 'keyword.other.compile-only.forth',
  81. 'meta.block.forth',
  82. 'entity.name.function.forth'],
  83. regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)',
  84. caseInsensitive: true,
  85. push: [{ token: 'keyword.other.compile-only.forth',
  86. regex: ';(?:CODE)?',
  87. caseInsensitive: true,
  88. next: 'pop' },
  89. { include: '#constant' },
  90. { include: '#comment' },
  91. { include: '#string' },
  92. { include: '#word' },
  93. { include: '#variable' },
  94. { include: '#storage' },
  95. { defaultToken: 'meta.block.forth' }] }] };
  96. this.normalizeRules();
  97. };
  98. ForthHighlightRules.metaData = { fileTypes: ['frt', 'fs', 'ldr', 'fth', '4th'],
  99. foldingStartMarker: '/\\*\\*|\\{\\s*$',
  100. foldingStopMarker: '\\*\\*/|^\\s*\\}',
  101. keyEquivalent: '^~F',
  102. name: 'Forth',
  103. scopeName: 'source.forth' };
  104. oop.inherits(ForthHighlightRules, TextHighlightRules);
  105. exports.ForthHighlightRules = ForthHighlightRules;
  106. });
  107. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  108. var oop = require("../../lib/oop");
  109. var Range = require("../../range").Range;
  110. var BaseFoldMode = require("./fold_mode").FoldMode;
  111. var FoldMode = exports.FoldMode = function (commentRegex) {
  112. if (commentRegex) {
  113. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  114. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  115. }
  116. };
  117. oop.inherits(FoldMode, BaseFoldMode);
  118. (function () {
  119. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  120. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  121. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  122. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  123. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  124. this._getFoldWidgetBase = this.getFoldWidget;
  125. this.getFoldWidget = function (session, foldStyle, row) {
  126. var line = session.getLine(row);
  127. if (this.singleLineBlockCommentRe.test(line)) {
  128. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  129. return "";
  130. }
  131. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  132. if (!fw && this.startRegionRe.test(line))
  133. return "start"; // lineCommentRegionStart
  134. return fw;
  135. };
  136. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  137. var line = session.getLine(row);
  138. if (this.startRegionRe.test(line))
  139. return this.getCommentRegionBlock(session, line, row);
  140. var match = line.match(this.foldingStartMarker);
  141. if (match) {
  142. var i = match.index;
  143. if (match[1])
  144. return this.openingBracketBlock(session, match[1], row, i);
  145. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  146. if (range && !range.isMultiLine()) {
  147. if (forceMultiline) {
  148. range = this.getSectionRange(session, row);
  149. }
  150. else if (foldStyle != "all")
  151. range = null;
  152. }
  153. return range;
  154. }
  155. if (foldStyle === "markbegin")
  156. return;
  157. var match = line.match(this.foldingStopMarker);
  158. if (match) {
  159. var i = match.index + match[0].length;
  160. if (match[1])
  161. return this.closingBracketBlock(session, match[1], row, i);
  162. return session.getCommentFoldRange(row, i, -1);
  163. }
  164. };
  165. this.getSectionRange = function (session, row) {
  166. var line = session.getLine(row);
  167. var startIndent = line.search(/\S/);
  168. var startRow = row;
  169. var startColumn = line.length;
  170. row = row + 1;
  171. var endRow = row;
  172. var maxRow = session.getLength();
  173. while (++row < maxRow) {
  174. line = session.getLine(row);
  175. var indent = line.search(/\S/);
  176. if (indent === -1)
  177. continue;
  178. if (startIndent > indent)
  179. break;
  180. var subRange = this.getFoldWidgetRange(session, "all", row);
  181. if (subRange) {
  182. if (subRange.start.row <= startRow) {
  183. break;
  184. }
  185. else if (subRange.isMultiLine()) {
  186. row = subRange.end.row;
  187. }
  188. else if (startIndent == indent) {
  189. break;
  190. }
  191. }
  192. endRow = row;
  193. }
  194. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  195. };
  196. this.getCommentRegionBlock = function (session, line, row) {
  197. var startColumn = line.search(/\s*$/);
  198. var maxRow = session.getLength();
  199. var startRow = row;
  200. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  201. var depth = 1;
  202. while (++row < maxRow) {
  203. line = session.getLine(row);
  204. var m = re.exec(line);
  205. if (!m)
  206. continue;
  207. if (m[1])
  208. depth--;
  209. else
  210. depth++;
  211. if (!depth)
  212. break;
  213. }
  214. var endRow = row;
  215. if (endRow > startRow) {
  216. return new Range(startRow, startColumn, endRow, line.length);
  217. }
  218. };
  219. }).call(FoldMode.prototype);
  220. });
  221. ace.define("ace/mode/forth",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/forth_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  222. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  223. */
  224. "use strict";
  225. var oop = require("../lib/oop");
  226. var TextMode = require("./text").Mode;
  227. var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules;
  228. var FoldMode = require("./folding/cstyle").FoldMode;
  229. var Mode = function () {
  230. this.HighlightRules = ForthHighlightRules;
  231. this.foldingRules = new FoldMode();
  232. this.$behaviour = this.$defaultBehaviour;
  233. };
  234. oop.inherits(Mode, TextMode);
  235. (function () {
  236. this.lineCommentStart = "--";
  237. this.blockComment = null;
  238. this.$id = "ace/mode/forth";
  239. }).call(Mode.prototype);
  240. exports.Mode = Mode;
  241. }); (function() {
  242. ace.require(["ace/mode/forth"], function(m) {
  243. if (typeof module == "object" && typeof exports == "object" && module) {
  244. module.exports = m;
  245. }
  246. });
  247. })();