564f112fdc65153caebf74208a70dcf0.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. ace.define("ace/mode/ion_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/*
  2. THIS FILE WAS GENERATED BY 'ligand' USING 'mode_highlight_rules.js'
  3. */
  4. "use strict";
  5. var oop = require("../lib/oop");
  6. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  7. var IonHighlightRules = function () {
  8. var k_keywords_bool = "TRUE|FALSE";
  9. var k_bool = k_keywords_bool;
  10. var k_keywords_null = "NULL.NULL|NULL.BOOL|NULL.INT|NULL.FLOAT|NULL.DECIMAL|NULL.TIMESTAMP|NULL.STRING|NULL.SYMBOL|NULL.BLOB|NULL.CLOB|"
  11. + "NULL.STRUCT|NULL.LIST|NULL.SEXP|NULL";
  12. var k_null = k_keywords_null;
  13. var keywordMapper = this.createKeywordMapper({
  14. "constant.language.bool.ion": k_bool,
  15. "constant.language.null.ion": k_null
  16. }, "constant.other.symbol.identifier.ion", true);
  17. var keywordMapperRule = {
  18. token: keywordMapper,
  19. regex: "\\b\\w+(?:\\.\\w+)?\\b"
  20. };
  21. this.$rules = {
  22. "start": [
  23. {
  24. "include": "value"
  25. }
  26. ],
  27. "value": [
  28. {
  29. "include": "whitespace"
  30. },
  31. {
  32. "include": "comment"
  33. },
  34. {
  35. "include": "annotation"
  36. },
  37. {
  38. "include": "string"
  39. },
  40. {
  41. "include": "number"
  42. },
  43. {
  44. "include": "keywords"
  45. },
  46. {
  47. "include": "symbol"
  48. },
  49. {
  50. "include": "clob"
  51. },
  52. {
  53. "include": "blob"
  54. },
  55. {
  56. "include": "struct"
  57. },
  58. {
  59. "include": "list"
  60. },
  61. {
  62. "include": "sexp"
  63. }
  64. ],
  65. "sexp": [
  66. {
  67. "token": "punctuation.definition.sexp.begin.ion",
  68. "regex": "\\(",
  69. "push": [
  70. {
  71. "token": "punctuation.definition.sexp.end.ion",
  72. "regex": "\\)",
  73. "next": "pop"
  74. },
  75. {
  76. "include": "comment"
  77. },
  78. {
  79. "include": "value"
  80. },
  81. {
  82. "token": "storage.type.symbol.operator.ion",
  83. "regex": "[\\!\\#\\%\\&\\*\\+\\-\\./\\;\\<\\=\\>\\?\\@\\^\\`\\|\\~]+"
  84. }
  85. ]
  86. }
  87. ],
  88. "comment": [
  89. {
  90. "token": "comment.line.ion",
  91. "regex": "//[^\\n]*"
  92. },
  93. {
  94. "token": "comment.block.ion",
  95. "regex": "/\\*",
  96. "push": [
  97. {
  98. "token": "comment.block.ion",
  99. "regex": "[*]/",
  100. "next": "pop"
  101. },
  102. {
  103. "token": "comment.block.ion",
  104. "regex": "[^*/]+"
  105. },
  106. {
  107. "token": "comment.block.ion",
  108. "regex": "[*/]+"
  109. }
  110. ]
  111. }
  112. ],
  113. "list": [
  114. {
  115. "token": "punctuation.definition.list.begin.ion",
  116. "regex": "\\[",
  117. "push": [
  118. {
  119. "token": "punctuation.definition.list.end.ion",
  120. "regex": "\\]",
  121. "next": "pop"
  122. },
  123. {
  124. "include": "comment"
  125. },
  126. {
  127. "include": "value"
  128. },
  129. {
  130. "token": "punctuation.definition.list.separator.ion",
  131. "regex": ","
  132. }
  133. ]
  134. }
  135. ],
  136. "struct": [
  137. {
  138. "token": "punctuation.definition.struct.begin.ion",
  139. "regex": "\\{",
  140. "push": [
  141. {
  142. "token": "punctuation.definition.struct.end.ion",
  143. "regex": "\\}",
  144. "next": "pop"
  145. },
  146. {
  147. "include": "comment"
  148. },
  149. {
  150. "include": "value"
  151. },
  152. {
  153. "token": "punctuation.definition.struct.separator.ion",
  154. "regex": ",|:"
  155. }
  156. ]
  157. }
  158. ],
  159. "blob": [
  160. {
  161. "token": [
  162. "punctuation.definition.blob.begin.ion",
  163. "string.other.blob.ion",
  164. "punctuation.definition.blob.end.ion"
  165. ],
  166. "regex": "(\\{\\{)([^\"]*)(\\}\\})"
  167. }
  168. ],
  169. "clob": [
  170. {
  171. "token": [
  172. "punctuation.definition.clob.begin.ion",
  173. "string.other.clob.ion",
  174. "punctuation.definition.clob.end.ion"
  175. ],
  176. "regex": "(\\{\\{)(\"[^\"]*\")(\\}\\})"
  177. }
  178. ],
  179. "symbol": [
  180. {
  181. "token": "storage.type.symbol.quoted.ion",
  182. "regex": "(['])((?:(?:\\\\')|(?:[^']))*?)(['])"
  183. },
  184. {
  185. "token": "storage.type.symbol.identifier.ion",
  186. "regex": "[\\$_a-zA-Z][\\$_a-zA-Z0-9]*"
  187. }
  188. ],
  189. "number": [
  190. {
  191. "token": "constant.numeric.timestamp.ion",
  192. "regex": "\\d{4}(?:-\\d{2})?(?:-\\d{2})?T(?:\\d{2}:\\d{2})(?::\\d{2})?(?:\\.\\d+)?(?:Z|[-+]\\d{2}:\\d{2})?"
  193. },
  194. {
  195. "token": "constant.numeric.timestamp.ion",
  196. "regex": "\\d{4}-\\d{2}-\\d{2}T?"
  197. },
  198. {
  199. "token": "constant.numeric.integer.binary.ion",
  200. "regex": "-?0[bB][01](?:_?[01])*"
  201. },
  202. {
  203. "token": "constant.numeric.integer.hex.ion",
  204. "regex": "-?0[xX][0-9a-fA-F](?:_?[0-9a-fA-F])*"
  205. },
  206. {
  207. "token": "constant.numeric.float.ion",
  208. "regex": "-?(?:0|[1-9](?:_?\\d)*)(?:\\.(?:\\d(?:_?\\d)*)?)?(?:[eE][+-]?\\d+)"
  209. },
  210. {
  211. "token": "constant.numeric.float.ion",
  212. "regex": "(?:[-+]inf)|(?:nan)"
  213. },
  214. {
  215. "token": "constant.numeric.decimal.ion",
  216. "regex": "-?(?:0|[1-9](?:_?\\d)*)(?:(?:(?:\\.(?:\\d(?:_?\\d)*)?)(?:[dD][+-]?\\d+)|\\.(?:\\d(?:_?\\d)*)?)|(?:[dD][+-]?\\d+))"
  217. },
  218. {
  219. "token": "constant.numeric.integer.ion",
  220. "regex": "-?(?:0|[1-9](?:_?\\d)*)"
  221. }
  222. ],
  223. "string": [
  224. {
  225. "token": [
  226. "punctuation.definition.string.begin.ion",
  227. "string.quoted.double.ion",
  228. "punctuation.definition.string.end.ion"
  229. ],
  230. "regex": "([\"])((?:(?:\\\\\")|(?:[^\"]))*?)([\"])"
  231. },
  232. {
  233. "token": "punctuation.definition.string.begin.ion",
  234. "regex": "'{3}",
  235. "push": [
  236. {
  237. "token": "punctuation.definition.string.end.ion",
  238. "regex": "'{3}",
  239. "next": "pop"
  240. },
  241. {
  242. "token": "string.quoted.triple.ion",
  243. "regex": "(?:\\\\'|[^'])+"
  244. },
  245. {
  246. "token": "string.quoted.triple.ion",
  247. "regex": "'"
  248. }
  249. ]
  250. }
  251. ],
  252. "annotation": [
  253. {
  254. "token": [
  255. "variable.language.annotation.ion",
  256. "punctuation.definition.annotation.ion"
  257. ],
  258. "regex": "('(?:[^']|\\\\\\\\|\\\\')*')\\s*(::)"
  259. },
  260. {
  261. "token": [
  262. "variable.language.annotation.ion",
  263. "punctuation.definition.annotation.ion"
  264. ],
  265. "regex": "([\\$_a-zA-Z][\\$_a-zA-Z0-9]*)\\s*(::)"
  266. }
  267. ],
  268. "whitespace": [
  269. {
  270. "token": "text.ion",
  271. "regex": "\\s+"
  272. }
  273. ]
  274. };
  275. this.$rules["keywords"] = [keywordMapperRule];
  276. this.normalizeRules();
  277. };
  278. oop.inherits(IonHighlightRules, TextHighlightRules);
  279. exports.IonHighlightRules = IonHighlightRules;
  280. });
  281. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  282. var Range = require("../range").Range;
  283. var MatchingBraceOutdent = function () { };
  284. (function () {
  285. this.checkOutdent = function (line, input) {
  286. if (!/^\s+$/.test(line))
  287. return false;
  288. return /^\s*\}/.test(input);
  289. };
  290. this.autoOutdent = function (doc, row) {
  291. var line = doc.getLine(row);
  292. var match = line.match(/^(\s*\})/);
  293. if (!match)
  294. return 0;
  295. var column = match[1].length;
  296. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  297. if (!openBracePos || openBracePos.row == row)
  298. return 0;
  299. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  300. doc.replace(new Range(row, 0, row, column - 1), indent);
  301. };
  302. this.$getIndent = function (line) {
  303. return line.match(/^\s*/)[0];
  304. };
  305. }).call(MatchingBraceOutdent.prototype);
  306. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  307. });
  308. 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";
  309. var oop = require("../../lib/oop");
  310. var Range = require("../../range").Range;
  311. var BaseFoldMode = require("./fold_mode").FoldMode;
  312. var FoldMode = exports.FoldMode = function (commentRegex) {
  313. if (commentRegex) {
  314. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  315. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  316. }
  317. };
  318. oop.inherits(FoldMode, BaseFoldMode);
  319. (function () {
  320. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  321. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  322. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  323. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  324. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  325. this._getFoldWidgetBase = this.getFoldWidget;
  326. this.getFoldWidget = function (session, foldStyle, row) {
  327. var line = session.getLine(row);
  328. if (this.singleLineBlockCommentRe.test(line)) {
  329. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  330. return "";
  331. }
  332. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  333. if (!fw && this.startRegionRe.test(line))
  334. return "start"; // lineCommentRegionStart
  335. return fw;
  336. };
  337. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  338. var line = session.getLine(row);
  339. if (this.startRegionRe.test(line))
  340. return this.getCommentRegionBlock(session, line, row);
  341. var match = line.match(this.foldingStartMarker);
  342. if (match) {
  343. var i = match.index;
  344. if (match[1])
  345. return this.openingBracketBlock(session, match[1], row, i);
  346. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  347. if (range && !range.isMultiLine()) {
  348. if (forceMultiline) {
  349. range = this.getSectionRange(session, row);
  350. }
  351. else if (foldStyle != "all")
  352. range = null;
  353. }
  354. return range;
  355. }
  356. if (foldStyle === "markbegin")
  357. return;
  358. var match = line.match(this.foldingStopMarker);
  359. if (match) {
  360. var i = match.index + match[0].length;
  361. if (match[1])
  362. return this.closingBracketBlock(session, match[1], row, i);
  363. return session.getCommentFoldRange(row, i, -1);
  364. }
  365. };
  366. this.getSectionRange = function (session, row) {
  367. var line = session.getLine(row);
  368. var startIndent = line.search(/\S/);
  369. var startRow = row;
  370. var startColumn = line.length;
  371. row = row + 1;
  372. var endRow = row;
  373. var maxRow = session.getLength();
  374. while (++row < maxRow) {
  375. line = session.getLine(row);
  376. var indent = line.search(/\S/);
  377. if (indent === -1)
  378. continue;
  379. if (startIndent > indent)
  380. break;
  381. var subRange = this.getFoldWidgetRange(session, "all", row);
  382. if (subRange) {
  383. if (subRange.start.row <= startRow) {
  384. break;
  385. }
  386. else if (subRange.isMultiLine()) {
  387. row = subRange.end.row;
  388. }
  389. else if (startIndent == indent) {
  390. break;
  391. }
  392. }
  393. endRow = row;
  394. }
  395. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  396. };
  397. this.getCommentRegionBlock = function (session, line, row) {
  398. var startColumn = line.search(/\s*$/);
  399. var maxRow = session.getLength();
  400. var startRow = row;
  401. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  402. var depth = 1;
  403. while (++row < maxRow) {
  404. line = session.getLine(row);
  405. var m = re.exec(line);
  406. if (!m)
  407. continue;
  408. if (m[1])
  409. depth--;
  410. else
  411. depth++;
  412. if (!depth)
  413. break;
  414. }
  415. var endRow = row;
  416. if (endRow > startRow) {
  417. return new Range(startRow, startColumn, endRow, line.length);
  418. }
  419. };
  420. }).call(FoldMode.prototype);
  421. });
  422. ace.define("ace/mode/ion",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ion_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){/*
  423. THIS FILE WAS GENERATED BY 'ligand' USING 'mode.js'
  424. */
  425. "use strict";
  426. var oop = require("../lib/oop");
  427. var TextMode = require("./text").Mode;
  428. var HighlightRules = require("./ion_highlight_rules").IonHighlightRules;
  429. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  430. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  431. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  432. var Mode = function () {
  433. this.HighlightRules = HighlightRules;
  434. this.$outdent = new MatchingBraceOutdent();
  435. this.$behaviour = new CstyleBehaviour();
  436. this.foldingRules = new CStyleFoldMode();
  437. };
  438. oop.inherits(Mode, TextMode);
  439. (function () {
  440. this.lineCommentStart = "//";
  441. this.blockComment = { start: "/*", end: "*/" };
  442. this.getNextLineIndent = function (state, line, tab) {
  443. var indent = this.$getIndent(line);
  444. if (state == "start") {
  445. var match = line.match(/^.*[\{\(\[]\s*$/);
  446. if (match) {
  447. indent += tab;
  448. }
  449. }
  450. return indent;
  451. };
  452. this.checkOutdent = function (state, line, input) {
  453. return this.$outdent.checkOutdent(line, input);
  454. };
  455. this.autoOutdent = function (state, doc, row) {
  456. this.$outdent.autoOutdent(doc, row);
  457. };
  458. this.$id = "ace/mode/ion";
  459. }).call(Mode.prototype);
  460. exports.Mode = Mode;
  461. }); (function() {
  462. ace.require(["ace/mode/ion"], function(m) {
  463. if (typeof module == "object" && typeof exports == "object" && module) {
  464. module.exports = m;
  465. }
  466. });
  467. })();