3a820eb0c0fb52f9b75e34214b5f8c9c.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. ace.define("ace/mode/fsl_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 FSLHighlightRules = function () {
  5. this.$rules = {
  6. start: [{
  7. token: "punctuation.definition.comment.mn",
  8. regex: /\/\*/,
  9. push: [{
  10. token: "punctuation.definition.comment.mn",
  11. regex: /\*\//,
  12. next: "pop"
  13. }, {
  14. defaultToken: "comment.block.fsl"
  15. }]
  16. }, {
  17. token: "comment.line.fsl",
  18. regex: /\/\//,
  19. push: [{
  20. token: "comment.line.fsl",
  21. regex: /$/,
  22. next: "pop"
  23. }, {
  24. defaultToken: "comment.line.fsl"
  25. }]
  26. }, {
  27. token: "entity.name.function",
  28. regex: /\${/,
  29. push: [{
  30. token: "entity.name.function",
  31. regex: /}/,
  32. next: "pop"
  33. }, {
  34. defaultToken: "keyword.other"
  35. }],
  36. comment: "js outcalls"
  37. }, {
  38. token: "constant.numeric",
  39. regex: /[0-9]*\.[0-9]*\.[0-9]*/,
  40. comment: "semver"
  41. }, {
  42. token: "constant.language.fslLanguage",
  43. regex: "(?:"
  44. + "graph_layout|machine_name|machine_author|machine_license|machine_comment|machine_language"
  45. + "|machine_version|machine_reference|npm_name|graph_layout|on_init|on_halt|on_end|on_terminate|on_finalize|on_transition"
  46. + "|on_action|on_stochastic_action|on_legal|on_main|on_forced|on_validation|on_validation_failure|on_transition_refused|on_forced_transition_refused"
  47. + "|on_action_refused|on_enter|on_exit|start_states|end_states|terminal_states|final_states|fsl_version"
  48. + ")\\s*:"
  49. }, {
  50. token: "keyword.control.transition.fslArrow",
  51. regex: /<->|<-|->|<=>|=>|<=|<~>|~>|<~|<-=>|<=->|<-~>|<~->|<=~>|<~=>/
  52. }, {
  53. token: "constant.numeric.fslProbability",
  54. regex: /[0-9]+%/,
  55. comment: "edge probability annotation"
  56. }, {
  57. token: "constant.character.fslAction",
  58. regex: /\'[^']*\'/,
  59. comment: "action annotation"
  60. }, {
  61. token: "string.quoted.double.fslLabel.doublequoted",
  62. regex: /\"[^"]*\"/,
  63. comment: "fsl label annotation"
  64. }, {
  65. token: "entity.name.tag.fslLabel.atom",
  66. regex: /[a-zA-Z0-9_.+&()#@!?,]/,
  67. comment: "fsl label annotation"
  68. }]
  69. };
  70. this.normalizeRules();
  71. };
  72. FSLHighlightRules.metaData = {
  73. fileTypes: ["fsl", "fsl_state"],
  74. name: "FSL",
  75. scopeName: "source.fsl"
  76. };
  77. oop.inherits(FSLHighlightRules, TextHighlightRules);
  78. exports.FSLHighlightRules = FSLHighlightRules;
  79. });
  80. 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";
  81. var oop = require("../../lib/oop");
  82. var Range = require("../../range").Range;
  83. var BaseFoldMode = require("./fold_mode").FoldMode;
  84. var FoldMode = exports.FoldMode = function (commentRegex) {
  85. if (commentRegex) {
  86. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  87. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  88. }
  89. };
  90. oop.inherits(FoldMode, BaseFoldMode);
  91. (function () {
  92. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  93. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  94. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  95. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  96. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  97. this._getFoldWidgetBase = this.getFoldWidget;
  98. this.getFoldWidget = function (session, foldStyle, row) {
  99. var line = session.getLine(row);
  100. if (this.singleLineBlockCommentRe.test(line)) {
  101. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  102. return "";
  103. }
  104. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  105. if (!fw && this.startRegionRe.test(line))
  106. return "start"; // lineCommentRegionStart
  107. return fw;
  108. };
  109. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  110. var line = session.getLine(row);
  111. if (this.startRegionRe.test(line))
  112. return this.getCommentRegionBlock(session, line, row);
  113. var match = line.match(this.foldingStartMarker);
  114. if (match) {
  115. var i = match.index;
  116. if (match[1])
  117. return this.openingBracketBlock(session, match[1], row, i);
  118. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  119. if (range && !range.isMultiLine()) {
  120. if (forceMultiline) {
  121. range = this.getSectionRange(session, row);
  122. }
  123. else if (foldStyle != "all")
  124. range = null;
  125. }
  126. return range;
  127. }
  128. if (foldStyle === "markbegin")
  129. return;
  130. var match = line.match(this.foldingStopMarker);
  131. if (match) {
  132. var i = match.index + match[0].length;
  133. if (match[1])
  134. return this.closingBracketBlock(session, match[1], row, i);
  135. return session.getCommentFoldRange(row, i, -1);
  136. }
  137. };
  138. this.getSectionRange = function (session, row) {
  139. var line = session.getLine(row);
  140. var startIndent = line.search(/\S/);
  141. var startRow = row;
  142. var startColumn = line.length;
  143. row = row + 1;
  144. var endRow = row;
  145. var maxRow = session.getLength();
  146. while (++row < maxRow) {
  147. line = session.getLine(row);
  148. var indent = line.search(/\S/);
  149. if (indent === -1)
  150. continue;
  151. if (startIndent > indent)
  152. break;
  153. var subRange = this.getFoldWidgetRange(session, "all", row);
  154. if (subRange) {
  155. if (subRange.start.row <= startRow) {
  156. break;
  157. }
  158. else if (subRange.isMultiLine()) {
  159. row = subRange.end.row;
  160. }
  161. else if (startIndent == indent) {
  162. break;
  163. }
  164. }
  165. endRow = row;
  166. }
  167. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  168. };
  169. this.getCommentRegionBlock = function (session, line, row) {
  170. var startColumn = line.search(/\s*$/);
  171. var maxRow = session.getLength();
  172. var startRow = row;
  173. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  174. var depth = 1;
  175. while (++row < maxRow) {
  176. line = session.getLine(row);
  177. var m = re.exec(line);
  178. if (!m)
  179. continue;
  180. if (m[1])
  181. depth--;
  182. else
  183. depth++;
  184. if (!depth)
  185. break;
  186. }
  187. var endRow = row;
  188. if (endRow > startRow) {
  189. return new Range(startRow, startColumn, endRow, line.length);
  190. }
  191. };
  192. }).call(FoldMode.prototype);
  193. });
  194. ace.define("ace/mode/fsl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/fsl_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  195. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  196. */
  197. "use strict";
  198. var oop = require("../lib/oop");
  199. var TextMode = require("./text").Mode;
  200. var FSLHighlightRules = require("./fsl_highlight_rules").FSLHighlightRules;
  201. var FoldMode = require("./folding/cstyle").FoldMode;
  202. var Mode = function () {
  203. this.HighlightRules = FSLHighlightRules;
  204. this.foldingRules = new FoldMode();
  205. };
  206. oop.inherits(Mode, TextMode);
  207. (function () {
  208. this.lineCommentStart = "//";
  209. this.blockComment = { start: "/*", end: "*/" };
  210. this.$id = "ace/mode/fsl";
  211. this.snippetFileId = "ace/snippets/fsl";
  212. }).call(Mode.prototype);
  213. exports.Mode = Mode;
  214. }); (function() {
  215. ace.require(["ace/mode/fsl"], function(m) {
  216. if (typeof module == "object" && typeof exports == "object" && module) {
  217. module.exports = m;
  218. }
  219. });
  220. })();