You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2619 lines
320 KiB

12 months ago
  1. ace.define("ace/mode/xquery/jsoniq_lexer",["require","exports","module"], function(acequire, exports, module) {
  2. module.exports = (function outer (modules, cache, entry) {
  3. var previousRequire = typeof acequire == "function" && acequire;
  4. function newRequire(name, jumped){
  5. if(!cache[name]) {
  6. if(!modules[name]) {
  7. var currentRequire = typeof acequire == "function" && acequire;
  8. if (!jumped && currentRequire) return currentRequire(name, true);
  9. if (previousRequire) return previousRequire(name, true);
  10. var err = new Error('Cannot find module \'' + name + '\'');
  11. err.code = 'MODULE_NOT_FOUND';
  12. throw err;
  13. }
  14. var m = cache[name] = {exports:{}};
  15. modules[name][0].call(m.exports, function(x){
  16. var id = modules[name][1][x];
  17. return newRequire(id ? id : x);
  18. },m,m.exports,outer,modules,cache,entry);
  19. }
  20. return cache[name].exports;
  21. }
  22. for(var i=0;i<entry.length;i++) newRequire(entry[i]);
  23. return newRequire(entry[0]);
  24. })
  25. ({"/node_modules/xqlint/lib/lexers/JSONiqTokenizer.js":[function(_dereq_,module,exports){
  26. var JSONiqTokenizer = exports.JSONiqTokenizer = function JSONiqTokenizer(string, parsingEventHandler)
  27. {
  28. init(string, parsingEventHandler);
  29. var self = this;
  30. this.ParseException = function(b, e, s, o, x)
  31. {
  32. var
  33. begin = b,
  34. end = e,
  35. state = s,
  36. offending = o,
  37. expected = x;
  38. this.getBegin = function() {return begin;};
  39. this.getEnd = function() {return end;};
  40. this.getState = function() {return state;};
  41. this.getExpected = function() {return expected;};
  42. this.getOffending = function() {return offending;};
  43. this.getMessage = function()
  44. {
  45. return offending < 0 ? "lexical analysis failed" : "syntax error";
  46. };
  47. };
  48. function init(string, parsingEventHandler)
  49. {
  50. eventHandler = parsingEventHandler;
  51. input = string;
  52. size = string.length;
  53. reset(0, 0, 0);
  54. }
  55. this.getInput = function()
  56. {
  57. return input;
  58. };
  59. function reset(l, b, e)
  60. {
  61. b0 = b; e0 = b;
  62. l1 = l; b1 = b; e1 = e;
  63. end = e;
  64. eventHandler.reset(input);
  65. }
  66. this.getOffendingToken = function(e)
  67. {
  68. var o = e.getOffending();
  69. return o >= 0 ? JSONiqTokenizer.TOKEN[o] : null;
  70. };
  71. this.getExpectedTokenSet = function(e)
  72. {
  73. var expected;
  74. if (e.getExpected() < 0)
  75. {
  76. expected = JSONiqTokenizer.getTokenSet(- e.getState());
  77. }
  78. else
  79. {
  80. expected = [JSONiqTokenizer.TOKEN[e.getExpected()]];
  81. }
  82. return expected;
  83. };
  84. this.getErrorMessage = function(e)
  85. {
  86. var tokenSet = this.getExpectedTokenSet(e);
  87. var found = this.getOffendingToken(e);
  88. var prefix = input.substring(0, e.getBegin());
  89. var lines = prefix.split("\n");
  90. var line = lines.length;
  91. var column = lines[line - 1].length + 1;
  92. var size = e.getEnd() - e.getBegin();
  93. return e.getMessage()
  94. + (found == null ? "" : ", found " + found)
  95. + "\nwhile expecting "
  96. + (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]"))
  97. + "\n"
  98. + (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ")
  99. + "at line " + line + ", column " + column + ":\n..."
  100. + input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64))
  101. + "...";
  102. };
  103. this.parse_start = function()
  104. {
  105. eventHandler.startNonterminal("start", e0);
  106. lookahead1W(14); // ModuleDecl | Annotation | OptionDecl | Operator | Variable | Tag | AttrTest |
  107. switch (l1)
  108. {
  109. case 58: // '<![CDATA['
  110. shift(58); // '<![CDATA['
  111. break;
  112. case 57: // '<!--'
  113. shift(57); // '<!--'
  114. break;
  115. case 59: // '<?'
  116. shift(59); // '<?'
  117. break;
  118. case 43: // '(#'
  119. shift(43); // '(#'
  120. break;
  121. case 45: // '(:~'
  122. shift(45); // '(:~'
  123. break;
  124. case 44: // '(:'
  125. shift(44); // '(:'
  126. break;
  127. case 37: // '"'
  128. shift(37); // '"'
  129. break;
  130. case 41: // "'"
  131. shift(41); // "'"
  132. break;
  133. case 277: // '}'
  134. shift(277); // '}'
  135. break;
  136. case 274: // '{'
  137. shift(274); // '{'
  138. break;
  139. case 42: // '('
  140. shift(42); // '('
  141. break;
  142. case 46: // ')'
  143. shift(46); // ')'
  144. break;
  145. case 52: // '/'
  146. shift(52); // '/'
  147. break;
  148. case 65: // '['
  149. shift(65); // '['
  150. break;
  151. case 66: // ']'
  152. shift(66); // ']'
  153. break;
  154. case 49: // ','
  155. shift(49); // ','
  156. break;
  157. case 51: // '.'
  158. shift(51); // '.'
  159. break;
  160. case 56: // ';'
  161. shift(56); // ';'
  162. break;
  163. case 54: // ':'
  164. shift(54); // ':'
  165. break;
  166. case 36: // '!'
  167. shift(36); // '!'
  168. break;
  169. case 276: // '|'
  170. shift(276); // '|'
  171. break;
  172. case 40: // '$$'
  173. shift(40); // '$$'
  174. break;
  175. case 5: // Annotation
  176. shift(5); // Annotation
  177. break;
  178. case 4: // ModuleDecl
  179. shift(4); // ModuleDecl
  180. break;
  181. case 6: // OptionDecl
  182. shift(6); // OptionDecl
  183. break;
  184. case 15: // AttrTest
  185. shift(15); // AttrTest
  186. break;
  187. case 16: // Wildcard
  188. shift(16); // Wildcard
  189. break;
  190. case 18: // IntegerLiteral
  191. shift(18); // IntegerLiteral
  192. break;
  193. case 19: // DecimalLiteral
  194. shift(19); // DecimalLiteral
  195. break;
  196. case 20: // DoubleLiteral
  197. shift(20); // DoubleLiteral
  198. break;
  199. case 8: // Variable
  200. shift(8); // Variable
  201. break;
  202. case 9: // Tag
  203. shift(9); // Tag
  204. break;
  205. case 7: // Operator
  206. shift(7); // Operator
  207. break;
  208. case 35: // EOF
  209. shift(35); // EOF
  210. break;
  211. default:
  212. parse_EQName();
  213. }
  214. eventHandler.endNonterminal("start", e0);
  215. };
  216. this.parse_StartTag = function()
  217. {
  218. eventHandler.startNonterminal("StartTag", e0);
  219. lookahead1W(8); // QName | S^WS | EOF | '"' | "'" | '/>' | '=' | '>'
  220. switch (l1)
  221. {
  222. case 61: // '>'
  223. shift(61); // '>'
  224. break;
  225. case 53: // '/>'
  226. shift(53); // '/>'
  227. break;
  228. case 29: // QName
  229. shift(29); // QName
  230. break;
  231. case 60: // '='
  232. shift(60); // '='
  233. break;
  234. case 37: // '"'
  235. shift(37); // '"'
  236. break;
  237. case 41: // "'"
  238. shift(41); // "'"
  239. break;
  240. default:
  241. shift(35); // EOF
  242. }
  243. eventHandler.endNonterminal("StartTag", e0);
  244. };
  245. this.parse_TagContent = function()
  246. {
  247. eventHandler.startNonterminal("TagContent", e0);
  248. lookahead1(11); // Tag | EndTag | PredefinedEntityRef | ElementContentChar | CharRef | EOF |
  249. switch (l1)
  250. {
  251. case 25: // ElementContentChar
  252. shift(25); // ElementContentChar
  253. break;
  254. case 9: // Tag
  255. shift(9); // Tag
  256. break;
  257. case 10: // EndTag
  258. shift(10); // EndTag
  259. break;
  260. case 58: // '<![CDATA['
  261. shift(58); // '<![CDATA['
  262. break;
  263. case 57: // '<!--'
  264. shift(57); // '<!--'
  265. break;
  266. case 21: // PredefinedEntityRef
  267. shift(21); // PredefinedEntityRef
  268. break;
  269. case 31: // CharRef
  270. shift(31); // CharRef
  271. break;
  272. case 275: // '{{'
  273. shift(275); // '{{'
  274. break;
  275. case 278: // '}}'
  276. shift(278); // '}}'
  277. break;
  278. case 274: // '{'
  279. shift(274); // '{'
  280. break;
  281. default:
  282. shift(35); // EOF
  283. }
  284. eventHandler.endNonterminal("TagContent", e0);
  285. };
  286. this.parse_AposAttr = function()
  287. {
  288. eventHandler.startNonterminal("AposAttr", e0);
  289. lookahead1(10); // PredefinedEntityRef | EscapeApos | AposAttrContentChar | CharRef | EOF | "'" |
  290. switch (l1)
  291. {
  292. case 23: // EscapeApos
  293. shift(23); // EscapeApos
  294. break;
  295. case 27: // AposAttrContentChar
  296. shift(27); // AposAttrContentChar
  297. break;
  298. case 21: // PredefinedEntityRef
  299. shift(21); // PredefinedEntityRef
  300. break;
  301. case 31: // CharRef
  302. shift(31); // CharRef
  303. break;
  304. case 275: // '{{'
  305. shift(275); // '{{'
  306. break;
  307. case 278: // '}}'
  308. shift(278); // '}}'
  309. break;
  310. case 274: // '{'
  311. shift(274); // '{'
  312. break;
  313. case 41: // "'"
  314. shift(41); // "'"
  315. break;
  316. default:
  317. shift(35); // EOF
  318. }
  319. eventHandler.endNonterminal("AposAttr", e0);
  320. };
  321. this.parse_QuotAttr = function()
  322. {
  323. eventHandler.startNonterminal("QuotAttr", e0);
  324. lookahead1(9); // PredefinedEntityRef | EscapeQuot | QuotAttrContentChar | CharRef | EOF | '"' |
  325. switch (l1)
  326. {
  327. case 22: // EscapeQuot
  328. shift(22); // EscapeQuot
  329. break;
  330. case 26: // QuotAttrContentChar
  331. shift(26); // QuotAttrContentChar
  332. break;
  333. case 21: // PredefinedEntityRef
  334. shift(21); // PredefinedEntityRef
  335. break;
  336. case 31: // CharRef
  337. shift(31); // CharRef
  338. break;
  339. case 275: // '{{'
  340. shift(275); // '{{'
  341. break;
  342. case 278: // '}}'
  343. shift(278); // '}}'
  344. break;
  345. case 274: // '{'
  346. shift(274); // '{'
  347. break;
  348. case 37: // '"'
  349. shift(37); // '"'
  350. break;
  351. default:
  352. shift(35); // EOF
  353. }
  354. eventHandler.endNonterminal("QuotAttr", e0);
  355. };
  356. this.parse_CData = function()
  357. {
  358. eventHandler.startNonterminal("CData", e0);
  359. lookahead1(1); // CDataSectionContents | EOF | ']]>'
  360. switch (l1)
  361. {
  362. case 14: // CDataSectionContents
  363. shift(14); // CDataSectionContents
  364. break;
  365. case 67: // ']]>'
  366. shift(67); // ']]>'
  367. break;
  368. default:
  369. shift(35); // EOF
  370. }
  371. eventHandler.endNonterminal("CData", e0);
  372. };
  373. this.parse_XMLComment = function()
  374. {
  375. eventHandler.startNonterminal("XMLComment", e0);
  376. lookahead1(0); // DirCommentContents | EOF | '-->'
  377. switch (l1)
  378. {
  379. case 12: // DirCommentContents
  380. shift(12); // DirCommentContents
  381. break;
  382. case 50: // '-->'
  383. shift(50); // '-->'
  384. break;
  385. default:
  386. shift(35); // EOF
  387. }
  388. eventHandler.endNonterminal("XMLComment", e0);
  389. };
  390. this.parse_PI = function()
  391. {
  392. eventHandler.startNonterminal("PI", e0);
  393. lookahead1(3); // DirPIContents | EOF | '?' | '?>'
  394. switch (l1)
  395. {
  396. case 13: // DirPIContents
  397. shift(13); // DirPIContents
  398. break;
  399. case 62: // '?'
  400. shift(62); // '?'
  401. break;
  402. case 63: // '?>'
  403. shift(63); // '?>'
  404. break;
  405. default:
  406. shift(35); // EOF
  407. }
  408. eventHandler.endNonterminal("PI", e0);
  409. };
  410. this.parse_Pragma = function()
  411. {
  412. eventHandler.startNonterminal("Pragma", e0);
  413. lookahead1(2); // PragmaContents | EOF | '#' | '#)'
  414. switch (l1)
  415. {
  416. case 11: // PragmaContents
  417. shift(11); // PragmaContents
  418. break;
  419. case 38: // '#'
  420. shift(38); // '#'
  421. break;
  422. case 39: // '#)'
  423. shift(39); // '#)'
  424. break;
  425. default:
  426. shift(35); // EOF
  427. }
  428. eventHandler.endNonterminal("Pragma", e0);
  429. };
  430. this.parse_Comment = function()
  431. {
  432. eventHandler.startNonterminal("Comment", e0);
  433. lookahead1(4); // CommentContents | EOF | '(:' | ':)'
  434. switch (l1)
  435. {
  436. case 55: // ':)'
  437. shift(55); // ':)'
  438. break;
  439. case 44: // '(:'
  440. shift(44); // '(:'
  441. break;
  442. case 32: // CommentContents
  443. shift(32); // CommentContents
  444. break;
  445. default:
  446. shift(35); // EOF
  447. }
  448. eventHandler.endNonterminal("Comment", e0);
  449. };
  450. this.parse_CommentDoc = function()
  451. {
  452. eventHandler.startNonterminal("CommentDoc", e0);
  453. lookahead1(6); // DocTag | DocCommentContents | EOF | '(:' | ':)'
  454. switch (l1)
  455. {
  456. case 33: // DocTag
  457. shift(33); // DocTag
  458. break;
  459. case 34: // DocCommentContents
  460. shift(34); // DocCommentContents
  461. break;
  462. case 55: // ':)'
  463. shift(55); // ':)'
  464. break;
  465. case 44: // '(:'
  466. shift(44); // '(:'
  467. break;
  468. default:
  469. shift(35); // EOF
  470. }
  471. eventHandler.endNonterminal("CommentDoc", e0);
  472. };
  473. this.parse_QuotString = function()
  474. {
  475. eventHandler.startNonterminal("QuotString", e0);
  476. lookahead1(5); // JSONChar | JSONCharRef | JSONPredefinedCharRef | EOF | '"'
  477. switch (l1)
  478. {
  479. case 3: // JSONPredefinedCharRef
  480. shift(3); // JSONPredefinedCharRef
  481. break;
  482. case 2: // JSONCharRef
  483. shift(2); // JSONCharRef
  484. break;
  485. case 1: // JSONChar
  486. shift(1); // JSONChar
  487. break;
  488. case 37: // '"'
  489. shift(37); // '"'
  490. break;
  491. default:
  492. shift(35); // EOF
  493. }
  494. eventHandler.endNonterminal("QuotString", e0);
  495. };
  496. this.parse_AposString = function()
  497. {
  498. eventHandler.startNonterminal("AposString", e0);
  499. lookahead1(7); // PredefinedEntityRef | EscapeApos | AposChar | CharRef | EOF | "'"
  500. switch (l1)
  501. {
  502. case 21: // PredefinedEntityRef
  503. shift(21); // PredefinedEntityRef
  504. break;
  505. case 31: // CharRef
  506. shift(31); // CharRef
  507. break;
  508. case 23: // EscapeApos
  509. shift(23); // EscapeApos
  510. break;
  511. case 24: // AposChar
  512. shift(24); // AposChar
  513. break;
  514. case 41: // "'"
  515. shift(41); // "'"
  516. break;
  517. default:
  518. shift(35); // EOF
  519. }
  520. eventHandler.endNonterminal("AposString", e0);
  521. };
  522. this.parse_Prefix = function()
  523. {
  524. eventHandler.startNonterminal("Prefix", e0);
  525. lookahead1W(13); // NCName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
  526. whitespace();
  527. parse_NCName();
  528. eventHandler.endNonterminal("Prefix", e0);
  529. };
  530. this.parse__EQName = function()
  531. {
  532. eventHandler.startNonterminal("_EQName", e0);
  533. lookahead1W(12); // EQName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
  534. whitespace();
  535. parse_EQName();
  536. eventHandler.endNonterminal("_EQName", e0);
  537. };
  538. function parse_EQName()
  539. {
  540. eventHandler.startNonterminal("EQName", e0);
  541. switch (l1)
  542. {
  543. case 80: // 'attribute'
  544. shift(80); // 'attribute'
  545. break;
  546. case 94: // 'comment'
  547. shift(94); // 'comment'
  548. break;
  549. case 118: // 'document-node'
  550. shift(118); // 'document-node'
  551. break;
  552. case 119: // 'element'
  553. shift(119); // 'element'
  554. break;
  555. case 122: // 'empty-sequence'
  556. shift(122); // 'empty-sequence'
  557. break;
  558. case 143: // 'function'
  559. shift(143); // 'function'
  560. break;
  561. case 150: // 'if'
  562. shift(150); // 'if'
  563. break;
  564. case 163: // 'item'
  565. shift(163); // 'item'
  566. break;
  567. case 183: // 'namespace-node'
  568. shift(183); // 'namespace-node'
  569. break;
  570. case 189: // 'node'
  571. shift(189); // 'node'
  572. break;
  573. case 214: // 'processing-instruction'
  574. shift(214); // 'processing-instruction'
  575. break;
  576. case 224: // 'schema-attribute'
  577. shift(224); // 'schema-attribute'
  578. break;
  579. case 225: // 'schema-element'
  580. shift(225); // 'schema-element'
  581. break;
  582. case 241: // 'switch'
  583. shift(241); // 'switch'
  584. break;
  585. case 242: // 'text'
  586. shift(242); // 'text'
  587. break;
  588. case 251: // 'typeswitch'
  589. shift(251); // 'typeswitch'
  590. break;
  591. default:
  592. parse_FunctionName();
  593. }
  594. eventHandler.endNonterminal("EQName", e0);
  595. }
  596. function parse_FunctionName()
  597. {
  598. eventHandler.startNonterminal("FunctionName", e0);
  599. switch (l1)
  600. {
  601. case 17: // EQName^Token
  602. shift(17); // EQName^Token
  603. break;
  604. case 68: // 'after'
  605. shift(68); // 'after'
  606. break;
  607. case 71: // 'ancestor'
  608. shift(71); // 'ancestor'
  609. break;
  610. case 72: // 'ancestor-or-self'
  611. shift(72); // 'ancestor-or-self'
  612. break;
  613. case 73: // 'and'
  614. shift(73); // 'and'
  615. break;
  616. case 77: // 'as'
  617. shift(77); // 'as'
  618. break;
  619. case 78: // 'ascending'
  620. shift(78); // 'ascending'
  621. break;
  622. case 82: // 'before'
  623. shift(82); // 'before'
  624. break;
  625. case 86: // 'case'
  626. shift(86); // 'case'
  627. break;
  628. case 87: // 'cast'
  629. shift(87); // 'cast'
  630. break;
  631. case 88: // 'castable'
  632. shift(88); // 'castable'
  633. break;
  634. case 91: // 'child'
  635. shift(91); // 'child'
  636. break;
  637. case 92: // 'collation'
  638. shift(92); // 'collation'
  639. break;
  640. case 101: // 'copy'
  641. shift(101); // 'copy'
  642. break;
  643. case 103: // 'count'
  644. shift(103); // 'count'
  645. break;
  646. case 106: // 'declare'
  647. shift(106); // 'declare'
  648. break;
  649. case 107: // 'default'
  650. shift(107); // 'default'
  651. break;
  652. case 108: // 'delete'
  653. shift(108); // 'delete'
  654. break;
  655. case 109: // 'descendant'
  656. shift(109); // 'descendant'
  657. break;
  658. case 110: // 'descendant-or-self'
  659. shift(110); // 'descendant-or-self'
  660. break;
  661. case 111: // 'descending'
  662. shift(111); // 'descending'
  663. break;
  664. case 116: // 'div'
  665. shift(116); // 'div'
  666. break;
  667. case 117: // 'document'
  668. shift(117); // 'document'
  669. break;
  670. case 120: // 'else'
  671. shift(120); // 'else'
  672. break;
  673. case 121: // 'empty'
  674. shift(121); // 'empty'
  675. break;
  676. case 124: // 'end'
  677. shift(124); // 'end'
  678. break;
  679. case 126: // 'eq'
  680. shift(126); // 'eq'
  681. break;
  682. case 127: // 'every'
  683. shift(127); // 'every'
  684. break;
  685. case 129: // 'except'
  686. shift(129); // 'except'
  687. break;
  688. case 132: // 'first'
  689. shift(132); // 'first'
  690. break;
  691. case 133: // 'following'
  692. shift(133); // 'following'
  693. break;
  694. case 134: // 'following-sibling'
  695. shift(134); // 'following-sibling'
  696. break;
  697. case 135: // 'for'
  698. shift(135); // 'for'
  699. break;
  700. case 144: // 'ge'
  701. shift(144); // 'ge'
  702. break;
  703. case 146: // 'group'
  704. shift(146); // 'group'
  705. break;
  706. case 148: // 'gt'
  707. shift(148); // 'gt'
  708. break;
  709. case 149: // 'idiv'
  710. shift(149); // 'idiv'
  711. break;
  712. case 151: // 'import'
  713. shift(151); // 'import'
  714. break;
  715. case 157: // 'insert'
  716. shift(157); // 'insert'
  717. break;
  718. case 158: // 'instance'
  719. shift(158); // 'instance'
  720. break;
  721. case 160: // 'intersect'
  722. shift(160); // 'intersect'
  723. break;
  724. case 161: // 'into'
  725. shift(161); // 'into'
  726. break;
  727. case 162: // 'is'
  728. shift(162); // 'is'
  729. break;
  730. case 168: // 'last'
  731. shift(168); // 'last'
  732. break;
  733. case 170: // 'le'
  734. shift(170); // 'le'
  735. break;
  736. case 172: // 'let'
  737. shift(172); // 'let'
  738. break;
  739. case 176: // 'lt'
  740. shift(176); // 'lt'
  741. break;
  742. case 178: // 'mod'
  743. shift(178); // 'mod'
  744. break;
  745. case 179: // 'modify'
  746. shift(179); // 'modify'
  747. break;
  748. case 180: // 'module'
  749. shift(180); // 'module'
  750. break;
  751. case 182: // 'namespace'
  752. shift(182); // 'namespace'
  753. break;
  754. case 184: // 'ne'
  755. shift(184); // 'ne'
  756. break;
  757. case 196: // 'only'
  758. shift(196); // 'only'
  759. break;
  760. case 198: // 'or'
  761. shift(198); // 'or'
  762. break;
  763. case 199: // 'order'
  764. shift(199); // 'order'
  765. break;
  766. case 200: // 'ordered'
  767. shift(200); // 'ordered'
  768. break;
  769. case 204: // 'parent'
  770. shift(204); // 'parent'
  771. break;
  772. case 210: // 'preceding'
  773. shift(210); // 'preceding'
  774. break;
  775. case 211: // 'preceding-sibling'
  776. shift(211); // 'preceding-sibling'
  777. break;
  778. case 216: // 'rename'
  779. shift(216); // 'rename'
  780. break;
  781. case 217: // 'replace'
  782. shift(217); // 'replace'
  783. break;
  784. case 218: // 'return'
  785. shift(218); // 'return'
  786. break;
  787. case 222: // 'satisfies'
  788. shift(222); // 'satisfies'
  789. break;
  790. case 227: // 'self'
  791. shift(227); // 'self'
  792. break;
  793. case 233: // 'some'
  794. shift(233); // 'some'
  795. break;
  796. case 234: // 'stable'
  797. shift(234); // 'stable'
  798. break;
  799. case 235: // 'start'
  800. shift(235); // 'start'
  801. break;
  802. case 246: // 'to'
  803. shift(246); // 'to'
  804. break;
  805. case 247: // 'treat'
  806. shift(247); // 'treat'
  807. break;
  808. case 248: // 'try'
  809. shift(248); // 'try'
  810. break;
  811. case 252: // 'union'
  812. shift(252); // 'union'
  813. break;
  814. case 254: // 'unordered'
  815. shift(254); // 'unordered'
  816. break;
  817. case 258: // 'validate'
  818. shift(258); // 'validate'
  819. break;
  820. case 264: // 'where'
  821. shift(264); // 'where'
  822. break;
  823. case 268: // 'with'
  824. shift(268); // 'with'
  825. break;
  826. case 272: // 'xquery'
  827. shift(272); // 'xquery'
  828. break;
  829. case 70: // 'allowing'
  830. shift(70); // 'allowing'
  831. break;
  832. case 79: // 'at'
  833. shift(79); // 'at'
  834. break;
  835. case 81: // 'base-uri'
  836. shift(81); // 'base-uri'
  837. break;
  838. case 83: // 'boundary-space'
  839. shift(83); // 'boundary-space'
  840. break;
  841. case 84: // 'break'
  842. shift(84); // 'break'
  843. break;
  844. case 89: // 'catch'
  845. shift(89); // 'catch'
  846. break;
  847. case 96: // 'construction'
  848. shift(96); // 'construction'
  849. break;
  850. case 99: // 'context'
  851. shift(99); // 'context'
  852. break;
  853. case 100: // 'continue'
  854. shift(100); // 'continue'
  855. break;
  856. case 102: // 'copy-namespaces'
  857. shift(102); // 'copy-namespaces'
  858. break;
  859. case 104: // 'decimal-format'
  860. shift(104); // 'decimal-format'
  861. break;
  862. case 123: // 'encoding'
  863. shift(123); // 'encoding'
  864. break;
  865. case 130: // 'exit'
  866. shift(130); // 'exit'
  867. break;
  868. case 131: // 'external'
  869. shift(131); // 'external'
  870. break;
  871. case 139: // 'ft-option'
  872. shift(139); // 'ft-option'
  873. break;
  874. case 152: // 'in'
  875. shift(152); // 'in'
  876. break;
  877. case 153: // 'index'
  878. shift(153); // 'index'
  879. break;
  880. case 159: // 'integrity'
  881. shift(159); // 'integrity'
  882. break;
  883. case 169: // 'lax'
  884. shift(169); // 'lax'
  885. break;
  886. case 190: // 'nodes'
  887. shift(190); // 'nodes'
  888. break;
  889. case 197: // 'option'
  890. shift(197); // 'option'
  891. break;
  892. case 201: // 'ordering'
  893. shift(201); // 'ordering'
  894. break;
  895. case 220: // 'revalidation'
  896. shift(220); // 'revalidation'
  897. break;
  898. case 223: // 'schema'
  899. shift(223); // 'schema'
  900. break;
  901. case 226: // 'score'
  902. shift(226); // 'score'
  903. break;
  904. case 232: // 'sliding'
  905. shift(232); // 'sliding'
  906. break;
  907. case 238: // 'strict'
  908. shift(238); // 'strict'
  909. break;
  910. case 249: // 'tumbling'
  911. shift(249); // 'tumbling'
  912. break;
  913. case 250: // 'type'
  914. shift(250); // 'type'
  915. break;
  916. case 255: // 'updating'
  917. shift(255); // 'updating'
  918. break;
  919. case 259: // 'value'
  920. shift(259); // 'value'
  921. break;
  922. case 260: // 'variable'
  923. shift(260); // 'variable'
  924. break;
  925. case 261: // 'version'
  926. shift(261); // 'version'
  927. break;
  928. case 265: // 'while'
  929. shift(265); // 'while'
  930. break;
  931. case 95: // 'constraint'
  932. shift(95); // 'constraint'
  933. break;
  934. case 174: // 'loop'
  935. shift(174); // 'loop'
  936. break;
  937. default:
  938. shift(219); // 'returning'
  939. }
  940. eventHandler.endNonterminal("FunctionName", e0);
  941. }
  942. function parse_NCName()
  943. {
  944. eventHandler.startNonterminal("NCName", e0);
  945. switch (l1)
  946. {
  947. case 28: // NCName^Token
  948. shift(28); // NCName^Token
  949. break;
  950. case 68: // 'after'
  951. shift(68); // 'after'
  952. break;
  953. case 73: // 'and'
  954. shift(73); // 'and'
  955. break;
  956. case 77: // 'as'
  957. shift(77); // 'as'
  958. break;
  959. case 78: // 'ascending'
  960. shift(78); // 'ascending'
  961. break;
  962. case 82: // 'before'
  963. shift(82); // 'before'
  964. break;
  965. case 86: // 'case'
  966. shift(86); // 'case'
  967. break;
  968. case 87: // 'cast'
  969. shift(87); // 'cast'
  970. break;
  971. case 88: // 'castable'
  972. shift(88); // 'castable'
  973. break;
  974. case 92: // 'collation'
  975. shift(92); // 'collation'
  976. break;
  977. case 103: // 'count'
  978. shift(103); // 'count'
  979. break;
  980. case 107: // 'default'
  981. shift(107); // 'default'
  982. break;
  983. case 111: // 'descending'
  984. shift(111); // 'descending'
  985. break;
  986. case 116: // 'div'
  987. shift(116); // 'div'
  988. break;
  989. case 120: // 'else'
  990. shift(120); // 'else'
  991. break;
  992. case 121: // 'empty'
  993. shift(121); // 'empty'
  994. break;
  995. case 124: // 'end'
  996. shift(124); // 'end'
  997. break;
  998. case 126: // 'eq'
  999. shift(126); // 'eq'
  1000. break;
  1001. case 129: // 'except'
  1002. shift(129); // 'except'
  1003. break;
  1004. case 135: // 'for'
  1005. shift(135); // 'for'
  1006. break;
  1007. case 144: // 'ge'
  1008. shift(144); // 'ge'
  1009. break;
  1010. case 146: // 'group'
  1011. shift(146); // 'group'
  1012. break;
  1013. case 148: // 'gt'
  1014. shift(148); // 'gt'
  1015. break;
  1016. case 149: // 'idiv'
  1017. shift(149); // 'idiv'
  1018. break;
  1019. case 158: // 'instance'
  1020. shift(158); // 'instance'
  1021. break;
  1022. case 160: // 'intersect'
  1023. shift(160); // 'intersect'
  1024. break;
  1025. case 161: // 'into'
  1026. shift(161); // 'into'
  1027. break;
  1028. case 162: // 'is'
  1029. shift(162); // 'is'
  1030. break;
  1031. case 170: // 'le'
  1032. shift(170); // 'le'
  1033. break;
  1034. case 172: // 'let'
  1035. shift(172); // 'let'
  1036. break;
  1037. case 176: // 'lt'
  1038. shift(176); // 'lt'
  1039. break;
  1040. case 178: // 'mod'
  1041. shift(178); // 'mod'
  1042. break;
  1043. case 179: // 'modify'
  1044. shift(179); // 'modify'
  1045. break;
  1046. case 184: // 'ne'
  1047. shift(184); // 'ne'
  1048. break;
  1049. case 196: // 'only'
  1050. shift(196); // 'only'
  1051. break;
  1052. case 198: // 'or'
  1053. shift(198); // 'or'
  1054. break;
  1055. case 199: // 'order'
  1056. shift(199); // 'order'
  1057. break;
  1058. case 218: // 'return'
  1059. shift(218); // 'return'
  1060. break;
  1061. case 222: // 'satisfies'
  1062. shift(222); // 'satisfies'
  1063. break;
  1064. case 234: // 'stable'
  1065. shift(234); // 'stable'
  1066. break;
  1067. case 235: // 'start'
  1068. shift(235); // 'start'
  1069. break;
  1070. case 246: // 'to'
  1071. shift(246); // 'to'
  1072. break;
  1073. case 247: // 'treat'
  1074. shift(247); // 'treat'
  1075. break;
  1076. case 252: // 'union'
  1077. shift(252); // 'union'
  1078. break;
  1079. case 264: // 'where'
  1080. shift(264); // 'where'
  1081. break;
  1082. case 268: // 'with'
  1083. shift(268); // 'with'
  1084. break;
  1085. case 71: // 'ancestor'
  1086. shift(71); // 'ancestor'
  1087. break;
  1088. case 72: // 'ancestor-or-self'
  1089. shift(72); // 'ancestor-or-self'
  1090. break;
  1091. case 80: // 'attribute'
  1092. shift(80); // 'attribute'
  1093. break;
  1094. case 91: // 'child'
  1095. shift(91); // 'child'
  1096. break;
  1097. case 94: // 'comment'
  1098. shift(94); // 'comment'
  1099. break;
  1100. case 101: // 'copy'
  1101. shift(101); // 'copy'
  1102. break;
  1103. case 106: // 'declare'
  1104. shift(106); // 'declare'
  1105. break;
  1106. case 108: // 'delete'
  1107. shift(108); // 'delete'
  1108. break;
  1109. case 109: // 'descendant'
  1110. shift(109); // 'descendant'
  1111. break;
  1112. case 110: // 'descendant-or-self'
  1113. shift(110); // 'descendant-or-self'
  1114. break;
  1115. case 117: // 'document'
  1116. shift(117); // 'document'
  1117. break;
  1118. case 118: // 'document-node'
  1119. shift(118); // 'document-node'
  1120. break;
  1121. case 119: // 'element'
  1122. shift(119); // 'element'
  1123. break;
  1124. case 122: // 'empty-sequence'
  1125. shift(122); // 'empty-sequence'
  1126. break;
  1127. case 127: // 'every'
  1128. shift(127); // 'every'
  1129. break;
  1130. case 132: // 'first'
  1131. shift(132); // 'first'
  1132. break;
  1133. case 133: // 'following'
  1134. shift(133); // 'following'
  1135. break;
  1136. case 134: // 'following-sibling'
  1137. shift(134); // 'following-sibling'
  1138. break;
  1139. case 143: // 'function'
  1140. shift(143); // 'function'
  1141. break;
  1142. case 150: // 'if'
  1143. shift(150); // 'if'
  1144. break;
  1145. case 151: // 'import'
  1146. shift(151); // 'import'
  1147. break;
  1148. case 157: // 'insert'
  1149. shift(157); // 'insert'
  1150. break;
  1151. case 163: // 'item'
  1152. shift(163); // 'item'
  1153. break;
  1154. case 168: // 'last'
  1155. shift(168); // 'last'
  1156. break;
  1157. case 180: // 'module'
  1158. shift(180); // 'module'
  1159. break;
  1160. case 182: // 'namespace'
  1161. shift(182); // 'namespace'
  1162. break;
  1163. case 183: // 'namespace-node'
  1164. shift(183); // 'namespace-node'
  1165. break;
  1166. case 189: // 'node'
  1167. shift(189); // 'node'
  1168. break;
  1169. case 200: // 'ordered'
  1170. shift(200); // 'ordered'
  1171. break;
  1172. case 204: // 'parent'
  1173. shift(204); // 'parent'
  1174. break;
  1175. case 210: // 'preceding'
  1176. shift(210); // 'preceding'
  1177. break;
  1178. case 211: // 'preceding-sibling'
  1179. shift(211); // 'preceding-sibling'
  1180. break;
  1181. case 214: // 'processing-instruction'
  1182. shift(214); // 'processing-instruction'
  1183. break;
  1184. case 216: // 'rename'
  1185. shift(216); // 'rename'
  1186. break;
  1187. case 217: // 'replace'
  1188. shift(217); // 'replace'
  1189. break;
  1190. case 224: // 'schema-attribute'
  1191. shift(224); // 'schema-attribute'
  1192. break;
  1193. case 225: // 'schema-element'
  1194. shift(225); // 'schema-element'
  1195. break;
  1196. case 227: // 'self'
  1197. shift(227); // 'self'
  1198. break;
  1199. case 233: // 'some'
  1200. shift(233); // 'some'
  1201. break;
  1202. case 241: // 'switch'
  1203. shift(241); // 'switch'
  1204. break;
  1205. case 242: // 'text'
  1206. shift(242); // 'text'
  1207. break;
  1208. case 248: // 'try'
  1209. shift(248); // 'try'
  1210. break;
  1211. case 251: // 'typeswitch'
  1212. shift(251); // 'typeswitch'
  1213. break;
  1214. case 254: // 'unordered'
  1215. shift(254); // 'unordered'
  1216. break;
  1217. case 258: // 'validate'
  1218. shift(258); // 'validate'
  1219. break;
  1220. case 260: // 'variable'
  1221. shift(260); // 'variable'
  1222. break;
  1223. case 272: // 'xquery'
  1224. shift(272); // 'xquery'
  1225. break;
  1226. case 70: // 'allowing'
  1227. shift(70); // 'allowing'
  1228. break;
  1229. case 79: // 'at'
  1230. shift(79); // 'at'
  1231. break;
  1232. case 81: // 'base-uri'
  1233. shift(81); // 'base-uri'
  1234. break;
  1235. case 83: // 'boundary-space'
  1236. shift(83); // 'boundary-space'
  1237. break;
  1238. case 84: // 'break'
  1239. shift(84); // 'break'
  1240. break;
  1241. case 89: // 'catch'
  1242. shift(89); // 'catch'
  1243. break;
  1244. case 96: // 'construction'
  1245. shift(96); // 'construction'
  1246. break;
  1247. case 99: // 'context'
  1248. shift(99); // 'context'
  1249. break;
  1250. case 100: // 'continue'
  1251. shift(100); // 'continue'
  1252. break;
  1253. case 102: // 'copy-namespaces'
  1254. shift(102); // 'copy-namespaces'
  1255. break;
  1256. case 104: // 'decimal-format'
  1257. shift(104); // 'decimal-format'
  1258. break;
  1259. case 123: // 'encoding'
  1260. shift(123); // 'encoding'
  1261. break;
  1262. case 130: // 'exit'
  1263. shift(130); // 'exit'
  1264. break;
  1265. case 131: // 'external'
  1266. shift(131); // 'external'
  1267. break;
  1268. case 139: // 'ft-option'
  1269. shift(139); // 'ft-option'
  1270. break;
  1271. case 152: // 'in'
  1272. shift(152); // 'in'
  1273. break;
  1274. case 153: // 'index'
  1275. shift(153); // 'index'
  1276. break;
  1277. case 159: // 'integrity'
  1278. shift(159); // 'integrity'
  1279. break;
  1280. case 169: // 'lax'
  1281. shift(169); // 'lax'
  1282. break;
  1283. case 190: // 'nodes'
  1284. shift(190); // 'nodes'
  1285. break;
  1286. case 197: // 'option'
  1287. shift(197); // 'option'
  1288. break;
  1289. case 201: // 'ordering'
  1290. shift(201); // 'ordering'
  1291. break;
  1292. case 220: // 'revalidation'
  1293. shift(220); // 'revalidation'
  1294. break;
  1295. case 223: // 'schema'
  1296. shift(223); // 'schema'
  1297. break;
  1298. case 226: // 'score'
  1299. shift(226); // 'score'
  1300. break;
  1301. case 232: // 'sliding'
  1302. shift(232); // 'sliding'
  1303. break;
  1304. case 238: // 'strict'
  1305. shift(238); // 'strict'
  1306. break;
  1307. case 249: // 'tumbling'
  1308. shift(249); // 'tumbling'
  1309. break;
  1310. case 250: // 'type'
  1311. shift(250); // 'type'
  1312. break;
  1313. case 255: // 'updating'
  1314. shift(255); // 'updating'
  1315. break;
  1316. case 259: // 'value'
  1317. shift(259); // 'value'
  1318. break;
  1319. case 261: // 'version'
  1320. shift(261); // 'version'
  1321. break;
  1322. case 265: // 'while'
  1323. shift(265); // 'while'
  1324. break;
  1325. case 95: // 'constraint'
  1326. shift(95); // 'constraint'
  1327. break;
  1328. case 174: // 'loop'
  1329. shift(174); // 'loop'
  1330. break;
  1331. default:
  1332. shift(219); // 'returning'
  1333. }
  1334. eventHandler.endNonterminal("NCName", e0);
  1335. }
  1336. function shift(t)
  1337. {
  1338. if (l1 == t)
  1339. {
  1340. whitespace();
  1341. eventHandler.terminal(JSONiqTokenizer.TOKEN[l1], b1, e1 > size ? size : e1);
  1342. b0 = b1; e0 = e1; l1 = 0;
  1343. }
  1344. else
  1345. {
  1346. error(b1, e1, 0, l1, t);
  1347. }
  1348. }
  1349. function whitespace()
  1350. {
  1351. if (e0 != b1)
  1352. {
  1353. b0 = e0;
  1354. e0 = b1;
  1355. eventHandler.whitespace(b0, e0);
  1356. }
  1357. }
  1358. function matchW(set)
  1359. {
  1360. var code;
  1361. for (;;)
  1362. {
  1363. code = match(set);
  1364. if (code != 30) // S^WS
  1365. {
  1366. break;
  1367. }
  1368. }
  1369. return code;
  1370. }
  1371. function lookahead1W(set)
  1372. {
  1373. if (l1 == 0)
  1374. {
  1375. l1 = matchW(set);
  1376. b1 = begin;
  1377. e1 = end;
  1378. }
  1379. }
  1380. function lookahead1(set)
  1381. {
  1382. if (l1 == 0)
  1383. {
  1384. l1 = match(set);
  1385. b1 = begin;
  1386. e1 = end;
  1387. }
  1388. }
  1389. function error(b, e, s, l, t)
  1390. {
  1391. throw new self.ParseException(b, e, s, l, t);
  1392. }
  1393. var lk, b0, e0;
  1394. var l1, b1, e1;
  1395. var eventHandler;
  1396. var input;
  1397. var size;
  1398. var begin;
  1399. var end;
  1400. function match(tokenSetId)
  1401. {
  1402. var nonbmp = false;
  1403. begin = end;
  1404. var current = end;
  1405. var result = JSONiqTokenizer.INITIAL[tokenSetId];
  1406. var state = 0;
  1407. for (var code = result & 4095; code != 0; )
  1408. {
  1409. var charclass;
  1410. var c0 = current < size ? input.charCodeAt(current) : 0;
  1411. ++current;
  1412. if (c0 < 0x80)
  1413. {
  1414. charclass = JSONiqTokenizer.MAP0[c0];
  1415. }
  1416. else if (c0 < 0xd800)
  1417. {
  1418. var c1 = c0 >> 4;
  1419. charclass = JSONiqTokenizer.MAP1[(c0 & 15) + JSONiqTokenizer.MAP1[(c1 & 31) + JSONiqTokenizer.MAP1[c1 >> 5]]];
  1420. }
  1421. else
  1422. {
  1423. if (c0 < 0xdc00)
  1424. {
  1425. var c1 = current < size ? input.charCodeAt(current) : 0;
  1426. if (c1 >= 0xdc00 && c1 < 0xe000)
  1427. {
  1428. ++current;
  1429. c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000;
  1430. nonbmp = true;
  1431. }
  1432. }
  1433. var lo = 0, hi = 5;
  1434. for (var m = 3; ; m = (hi + lo) >> 1)
  1435. {
  1436. if (JSONiqTokenizer.MAP2[m] > c0) hi = m - 1;
  1437. else if (JSONiqTokenizer.MAP2[6 + m] < c0) lo = m + 1;
  1438. else {charclass = JSONiqTokenizer.MAP2[12 + m]; break;}
  1439. if (lo > hi) {charclass = 0; break;}
  1440. }
  1441. }
  1442. state = code;
  1443. var i0 = (charclass << 12) + code - 1;
  1444. code = JSONiqTokenizer.TRANSITION[(i0 & 15) + JSONiqTokenizer.TRANSITION[i0 >> 4]];
  1445. if (code > 4095)
  1446. {
  1447. result = code;
  1448. code &= 4095;
  1449. end = current;
  1450. }
  1451. }
  1452. result >>= 12;
  1453. if (result == 0)
  1454. {
  1455. end = current - 1;
  1456. var c1 = end < size ? input.charCodeAt(end) : 0;
  1457. if (c1 >= 0xdc00 && c1 < 0xe000) --end;
  1458. return error(begin, end, state, -1, -1);
  1459. }
  1460. if (nonbmp)
  1461. {
  1462. for (var i = result >> 9; i > 0; --i)
  1463. {
  1464. --end;
  1465. var c1 = end < size ? input.charCodeAt(end) : 0;
  1466. if (c1 >= 0xdc00 && c1 < 0xe000) --end;
  1467. }
  1468. }
  1469. else
  1470. {
  1471. end -= result >> 9;
  1472. }
  1473. return (result & 511) - 1;
  1474. }
  1475. }
  1476. JSONiqTokenizer.getTokenSet = function(tokenSetId)
  1477. {
  1478. var set = [];
  1479. var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095;
  1480. for (var i = 0; i < 279; i += 32)
  1481. {
  1482. var j = i;
  1483. var i0 = (i >> 5) * 2066 + s - 1;
  1484. var i1 = i0 >> 2;
  1485. var i2 = i1 >> 2;
  1486. var f = JSONiqTokenizer.EXPECTED[(i0 & 3) + JSONiqTokenizer.EXPECTED[(i1 & 3) + JSONiqTokenizer.EXPECTED[(i2 & 3) + JSONiqTokenizer.EXPECTED[i2 >> 2]]]];
  1487. for ( ; f != 0; f >>>= 1, ++j)
  1488. {
  1489. if ((f & 1) != 0)
  1490. {
  1491. set.push(JSONiqTokenizer.TOKEN[j]);
  1492. }
  1493. }
  1494. }
  1495. return set;
  1496. };
  1497. JSONiqTokenizer.MAP0 =
  1498. [ 67, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 37, 31, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 31, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 31, 62, 63, 64, 65, 37
  1499. ];
  1500. JSONiqTokenizer.MAP1 =
  1501. [ 108, 124, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 156, 181, 181, 181, 181, 181, 214, 215, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 247, 261, 277, 293, 309, 347, 363, 379, 416, 416, 416, 408, 331, 323, 331, 323, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 433, 433, 433, 433, 433, 433, 433, 316, 331, 331, 331, 331, 331, 331, 331, 331, 394, 416, 416, 417, 415, 416, 416, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 67, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 37, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 37, 31, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 31, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 31, 62, 63, 64, 65, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 31, 31, 37, 37, 37, 37, 37, 37, 37, 66, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66
  1502. ];
  1503. JSONiqTokenizer.MAP2 =
  1504. [ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 37, 31, 37, 31, 31, 37
  1505. ];
  1506. JSONiqTokenizer.INITIAL =
  1507. [ 1, 2, 49155, 57348, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  1508. ];
  1509. JSONiqTokenizer.TRANSITION =
  1510. [ 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 17408, 19288, 17439, 36866, 17466, 36890, 36866, 21991, 22971, 22987, 17556, 17575, 22288, 17486, 17509, 17525, 18373, 18855, 22984, 17553, 17572, 22285, 22126, 17990, 18622, 19411, 20306, 17996, 17689, 17470, 17591, 20896, 17468, 17619, 22083, 36867, 19404, 20299, 36866, 17647, 17672, 18921, 19514, 17705, 20311, 37017, 17728, 17756, 17784, 17800, 17825, 17854, 18403, 18928, 19521, 17712, 37008, 19469, 17878, 18884, 17900, 17922, 17944, 18178, 17960, 18012, 18381, 18064, 18218, 17884, 18890, 17906, 17928, 18102, 25022, 18130, 36931, 36963, 17493, 18150, 18166, 18214, 25010, 25026, 36919, 18234, 18262, 18278, 18294, 18320, 18336, 18361, 18397, 18419, 18432, 18304, 18448, 18485, 18523, 18553, 18583, 18599, 18638, 18497, 19656, 18664, 18680, 18507, 18696, 19164, 18712, 18737, 17681, 22026, 20906, 20915, 22054, 17838, 17450, 22022, 18765, 18825, 18841, 18871, 18906, 18944, 18960, 18976, 19041, 19056, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19058, 19074, 36169, 17439, 36866, 17466, 36890, 36866, 22314, 19105, 22987, 17556, 17575, 22288, 17486, 17509, 17525, 18373, 18855, 22984, 17553, 17572, 22285, 22126, 17990, 18622, 19411, 20306, 17996, 17689, 17470, 17591, 20896, 17468, 17619, 22083, 36867, 19404, 20299, 36866, 17647, 17672, 18921, 19514, 17705, 20311, 37017, 17728, 17756, 17784, 17800, 17825, 17854, 18403, 18928, 19521, 17712, 37008, 19469, 17878, 18884, 17900, 17922, 17944, 18178, 17960, 18012, 18381, 18064, 18218, 17884, 18890, 17906, 17928
  1511. ];
  1512. JSONiqTokenizer.EXPECTED =
  1513. [ 291, 300, 304, 341, 315, 309, 305, 295, 319, 323, 327, 329, 296, 333, 337, 339, 342, 346, 350, 294, 356, 360, 312, 367, 352, 371, 363, 375, 379, 383, 387, 391, 395, 726, 399, 405, 518, 684, 405, 405, 405, 405, 808, 405, 405, 405, 512, 405, 405, 405, 431, 405, 405, 406, 405, 405, 404, 405, 405, 405, 405, 405, 405, 405, 908, 631, 410, 415, 405, 414, 419, 608, 405, 429, 602, 405, 435, 443, 405, 441, 641, 478, 405, 447, 451, 450, 456, 643, 461, 460, 762, 679, 465, 469, 741, 473, 477, 482, 486, 492, 932, 931, 523, 498, 504, 720, 405, 510, 596, 405, 516, 941, 580, 522, 929, 527, 590, 589, 897, 939, 534, 538, 547, 551, 555, 559, 563, 567, 571, 969, 575, 708, 690, 689, 579, 584, 634, 405, 594, 731, 405, 600, 882, 405, 606, 895, 786, 452, 612, 405, 615, 620, 876, 624, 628, 638, 647, 651, 655, 659, 663, 667, 676, 683, 688, 695, 694, 791, 405, 699, 437, 405, 706, 714, 405, 712, 825, 870, 405, 718, 724, 769, 768, 823, 730, 735, 745, 751, 422, 755, 759, 425, 766, 902, 810, 587, 775, 888, 887, 405, 773, 992, 405, 779, 962, 405, 785, 781, 986, 790, 795, 797, 506, 500, 499, 801, 805, 814, 820, 829, 833, 837, 841, 845, 849, 853, 857, 861, 616, 865, 869, 868, 488, 405, 874, 816, 405, 880, 738, 405, 886, 892, 543, 405, 901, 906, 913, 912, 918, 494, 541, 922, 926, 936, 945, 949, 953, 957, 530, 966, 973, 960, 702, 701, 405, 979, 981, 405, 985, 747, 405, 990, 998, 914, 405, 996, 1004, 672, 975, 974, 1014, 1002, 1008, 670, 1012, 405, 405, 405, 405, 405, 401, 1018, 1022, 1026, 1106, 1071, 1111, 1111, 1111, 1082, 1145, 1030, 1101, 1034, 1038, 1106, 1106, 1106, 1106, 1046, 1206, 1052, 1106, 1072, 1111, 1111, 1042, 1134, 1065, 1111, 1112, 1056, 1160, 1207, 1062, 1204, 1208, 1069, 1106, 1106, 1106, 1076, 1111, 1207, 1161, 1122, 1205, 1064, 1094, 1106, 1106, 1107, 1111, 1111, 1111, 1078, 1086, 1207, 1092, 1098, 1046, 1058, 1106, 1106, 1110, 1111, 1111, 1116, 1120, 1161, 1126, 1202, 1104, 1106, 1145, 1146, 1129, 1138, 1088, 1151, 1048, 1157, 1153, 1132, 1141, 1165, 1107, 1111, 1172, 1179, 1109, 1183, 1175, 1143, 1147, 1187, 1108, 1191, 1195, 1144, 1199, 1168, 1212, 1216, 1220, 1224, 1228, 1232, 1236, 1557, 1247, 1241, 1241, 1038, 1434, 1241, 1241, 1241, 1241, 1254, 1275, 1617, 1241, 1280, 1287, 1241, 1241, 1241, 1287, 1241, 2114, 1291, 1241, 1243, 1241, 2049, 1824, 2094, 2095, 1520, 1309, 1241, 1241, 1302, 1241, 1321, 1311, 1241, 1241, 1313, 1778, 1325, 1336, 1241, 1241, 1325, 1330, 1353, 1241, 1241, 1695, 1354, 1241, 1241, 1241, 1294, 1686, 1331, 1241, 1696, 1368, 1241, 1338, 1370, 1241, 1392, 1399, 1364, 2017, 1406, 2016, 1405, 1716, 1406, 1407, 1422, 1417, 1421, 1241, 1241, 1241, 1349, 1426, 1241, 1774, 1756, 1241, 1773, 1241, 1241, 1345, 1964, 1812, 1432, 1241, 1241, 1345, 1993, 1459, 1241, 1241, 1241, 1395, 1848, 1767, 1465, 1241, 1241, 1394, 1847, 1242, 1477, 1241, 1241, 1428, 1241, 1445, 1492, 1241, 1241, 1438, 1241, 1499, 1241, 1241, 1241, 1455, 1241, 1818, 1448, 1241, 1250, 1241, 2026, 1623, 1449, 1241, 1612, 1616, 1241, 1614, 1241, 1257, 1241, 1241, 1985, 1292, 1586, 1512, 1241, 1517, 2050, 1526, 1674, 1519, 1524, 1647, 2051, 1532, 1537, 1551, 1544, 1550, 1555, 1561, 1571, 1578, 1584, 1590, 1591, 1653, 1595, 1602, 1606, 1610, 1634, 1628, 1640, 1633, 1645, 1241, 1241, 1241, 1469, 1241, 1970, 1651, 1241, 1270, 1241, 1241, 1819, 1449, 1241, 1293, 1664, 1241, 1241, 1481, 1485, 1574, 1672, 1241, 1241, 1513, 1317, 1487, 1684, 1241, 1241, 1533, 1299, 1694, 1241, 1241, 1295, 1241, 1241, 1241, 1546, 1700, 1241, 1241, 1707, 1241, 1713, 1241, 1849, 1715, 1241, 1720, 1241, 1276, 1267, 1241, 1241, 2107, 1657, 1864, 1241, 1881, 1241, 1326, 1292, 1241, 1685, 1358, 1724, 1338, 1241, 1363, 1362, 1342, 1340, 1361, 1339, 1833, 1372, 1360, 1833, 1833, 1342, 1343, 1835, 1341, 1731, 1738, 1344, 1241, 1745, 1241, 1379, 1241, 1241, 2092, 1241, 1388, 1761, 1754, 1241, 1386, 1241, 1400, 1760, 1241, 1241, 1241, 1598, 1734, 1241, 1241, 1241, 1635, 1645, 1241, 1780, 1766, 1241, 1241, 1332, 1771, 1241, 1241, 1629, 2079, 1241, 1242, 1784, 1241, 1241, 1680, 1639, 2063, 1790, 1241, 1241, 1741, 1241, 1241, 1800, 1241, 1241, 1762, 1473, 1241, 1806, 1241, 1241, 1786, 1240,
  1514. ];
  1515. JSONiqTokenizer.TOKEN =
  1516. [
  1517. "(0)",
  1518. "JSONChar",
  1519. "JSONCharRef",
  1520. "JSONPredefinedCharRef",
  1521. "ModuleDecl",
  1522. "Annotation",
  1523. "OptionDecl",
  1524. "Operator",
  1525. "Variable",
  1526. "Tag",
  1527. "EndTag",
  1528. "PragmaContents",
  1529. "DirCommentContents",
  1530. "DirPIContents",
  1531. "CDataSectionContents",
  1532. "AttrTest",
  1533. "Wildcard",
  1534. "EQName",
  1535. "IntegerLiteral",
  1536. "DecimalLiteral",
  1537. "DoubleLiteral",
  1538. "PredefinedEntityRef",
  1539. "'\"\"'",
  1540. "EscapeApos",
  1541. "AposChar",
  1542. "ElementContentChar",
  1543. "QuotAttrContentChar",
  1544. "AposAttrContentChar",
  1545. "NCName",
  1546. "QName",
  1547. "S",
  1548. "CharRef",
  1549. "CommentContents",
  1550. "DocTag",
  1551. "DocCommentContents",
  1552. "EOF",
  1553. "'!'",
  1554. "'\"'",
  1555. "'#'",
  1556. "'#)'",
  1557. "'$$'",
  1558. "''''",
  1559. "'('",
  1560. "'(#'",
  1561. "'(:'",
  1562. "'(:~'",
  1563. "')'",
  1564. "'*'",
  1565. "'*'",
  1566. "','",
  1567. "'-->'",
  1568. "'.'",
  1569. "'/'",
  1570. "'/>'",
  1571. "':'",
  1572. "':)'",
  1573. "';'",
  1574. "'<!--'",
  1575. "'<![CDATA['",
  1576. "'<?'",
  1577. "'='",
  1578. "'>'",
  1579. "'?'",
  1580. "'?>'",
  1581. "'NaN'",
  1582. "'['",
  1583. "']'",
  1584. "']]>'",
  1585. "'after'",
  1586. "'all'",
  1587. "'allowing'",
  1588. "'ancestor'",
  1589. "'ancestor-or-self'",
  1590. "'and'",
  1591. "'any'",
  1592. "'append'",
  1593. "'array'",
  1594. "'as'",
  1595. "'ascending'",
  1596. "'at'",
  1597. "'attribute'",
  1598. "'base-uri'",
  1599. "'before'",
  1600. "'boundary-space'",
  1601. "'break'",
  1602. "'by'",
  1603. "'case'",
  1604. "'cast'",
  1605. "'castable'",
  1606. "'catch'",
  1607. "'check'",
  1608. "'child'",
  1609. "'collation'",
  1610. "'collection'",
  1611. "'comment'",
  1612. "'constraint'",
  1613. "'construction'",
  1614. "'contains'",
  1615. "'content'",
  1616. "'context'",
  1617. "'continue'",
  1618. "'copy'",
  1619. "'copy-namespaces'",
  1620. "'count'",
  1621. "'decimal-format'",
  1622. "'decimal-separator'",
  1623. "'declare'",
  1624. "'default'",
  1625. "'delete'",
  1626. "'descendant'",
  1627. "'descendant-or-self'",
  1628. "'descending'",
  1629. "'diacritics'",
  1630. "'different'",
  1631. "'digit'",
  1632. "'distance'",
  1633. "'div'",
  1634. "'document'",
  1635. "'document-node'",
  1636. "'element'",
  1637. "'else'",
  1638. "'empty'",
  1639. "'empty-sequence'",
  1640. "'encoding'",
  1641. "'end'",
  1642. "'entire'",
  1643. "'eq'",
  1644. "'every'",
  1645. "'exactly'",
  1646. "'except'",
  1647. "'exit'",
  1648. "'external'",
  1649. "'first'",
  1650. "'following'",
  1651. "'following-sibling'",
  1652. "'for'",
  1653. "'foreach'",
  1654. "'foreign'",
  1655. "'from'",
  1656. "'ft-option'",
  1657. "'ftand'",
  1658. "'ftnot'",
  1659. "'ftor'",
  1660. "'function'",
  1661. "'ge'",
  1662. "'greatest'",
  1663. "'group'",
  1664. "'grouping-separator'",
  1665. "'gt'",
  1666. "'idiv'",
  1667. "'if'",
  1668. "'import'",
  1669. "'in'",
  1670. "'index'",
  1671. "'infinity'",
  1672. "'inherit'",
  1673. "'insensitive'",
  1674. "'insert'",
  1675. "'instance'",
  1676. "'integrity'",
  1677. "'intersect'",
  1678. "'into'",
  1679. "'is'",
  1680. "'item'",
  1681. "'json'",
  1682. "'json-item'",
  1683. "'key'",
  1684. "'language'",
  1685. "'last'",
  1686. "'lax'",
  1687. "'le'",
  1688. "'least'",
  1689. "'let'",
  1690. "'levels'",
  1691. "'loop'",
  1692. "'lowercase'",
  1693. "'lt'",
  1694. "'minus-sign'",
  1695. "'mod'",
  1696. "'modify'",
  1697. "'module'",
  1698. "'most'",
  1699. "'namespace'",
  1700. "'namespace-node'",
  1701. "'ne'",
  1702. "'next'",
  1703. "'no'",
  1704. "'no-inherit'",
  1705. "'no-preserve'",
  1706. "'node'",
  1707. "'nodes'",
  1708. "'not'",
  1709. "'object'",
  1710. "'occurs'",
  1711. "'of'",
  1712. "'on'",
  1713. "'only'",
  1714. "'option'",
  1715. "'or'",
  1716. "'order'",
  1717. "'ordered'",
  1718. "'ordering'",
  1719. "'paragraph'",
  1720. "'paragraphs'",
  1721. "'parent'",
  1722. "'pattern-separator'",
  1723. "'per-mille'",
  1724. "'percent'",
  1725. "'phrase'",
  1726. "'position'",
  1727. "'preceding'",
  1728. "'preceding-sibling'",
  1729. "'preserve'",
  1730. "'previous'",
  1731. "'processing-instruction'",
  1732. "'relationship'",
  1733. "'rename'",
  1734. "'replace'",
  1735. "'return'",
  1736. "'returning'",
  1737. "'revalidation'",
  1738. "'same'",
  1739. "'satisfies'",
  1740. "'schema'",
  1741. "'schema-attribute'",
  1742. "'schema-element'",
  1743. "'score'",
  1744. "'self'",
  1745. "'sensitive'",
  1746. "'sentence'",
  1747. "'sentences'",
  1748. "'skip'",
  1749. "'sliding'",
  1750. "'some'",
  1751. "'stable'",
  1752. "'start'",
  1753. "'stemming'",
  1754. "'stop'",
  1755. "'strict'",
  1756. "'strip'",
  1757. "'structured-item'",
  1758. "'switch'",
  1759. "'text'",
  1760. "'then'",
  1761. "'thesaurus'",
  1762. "'times'",
  1763. "'to'",
  1764. "'treat'",
  1765. "'try'",
  1766. "'tumbling'",
  1767. "'type'",
  1768. "'typeswitch'",
  1769. "'union'",
  1770. "'unique'",
  1771. "'unordered'",
  1772. "'updating'",
  1773. "'uppercase'",
  1774. "'using'",
  1775. "'validate'",
  1776. "'value'",
  1777. "'variable'",
  1778. "'version'",
  1779. "'weight'",
  1780. "'when'",
  1781. "'where'",
  1782. "'while'",
  1783. "'wildcards'",
  1784. "'window'",
  1785. "'with'",
  1786. "'without'",
  1787. "'word'",
  1788. "'words'",
  1789. "'xquery'",
  1790. "'zero-digit'",
  1791. "'{'",
  1792. "'{{'",
  1793. "'|'",
  1794. "'}'",
  1795. "'}}'"
  1796. ];
  1797. },{}],"/node_modules/xqlint/lib/lexers/jsoniq_lexer.js":[function(_dereq_,module,exports){
  1798. 'use strict';
  1799. var JSONiqTokenizer = _dereq_('./JSONiqTokenizer').JSONiqTokenizer;
  1800. var Lexer = _dereq_('./lexer').Lexer;
  1801. var keys = 'NaN|after|allowing|ancestor|ancestor-or-self|and|append|array|as|ascending|at|attribute|base-uri|before|boundary-space|break|by|case|cast|castable|catch|child|collation|comment|constraint|construction|contains|context|continue|copy|copy-namespaces|count|decimal-format|decimal-separator|declare|default|delete|descendant|descendant-or-self|descending|digit|div|document|document-node|element|else|empty|empty-sequence|encoding|end|eq|every|except|exit|external|false|first|following|following-sibling|for|from|ft-option|function|ge|greatest|group|grouping-separator|gt|idiv|if|import|in|index|infinity|insert|instance|integrity|intersect|into|is|item|json|json-item|jsoniq|last|lax|le|least|let|loop|lt|minus-sign|mod|modify|module|namespace|namespace-node|ne|next|node|nodes|not|null|object|of|only|option|or|order|ordered|ordering|paragraphs|parent|pattern-separator|per-mille|percent|preceding|preceding-sibling|previous|processing-instruction|rename|replace|return|returning|revalidation|satisfies|schema|schema-attribute|schema-element|score|select|self|sentences|sliding|some|stable|start|strict|switch|text|then|times|to|treat|true|try|tumbling|type|typeswitch|union|unordered|updating|validate|value|variable|version|when|where|while|window|with|words|xquery|zero-digit'.split('|');
  1802. var keywords = keys.map(function(val) { return { name: '\'' + val + '\'', token: 'keyword' }; });
  1803. var ncnames = keys.map(function(val) { return { name: '\'' + val + '\'', token: 'text', next: function(stack){ stack.pop(); } }; });
  1804. var cdata = 'constant.language';
  1805. var number = 'constant';
  1806. var xmlcomment = 'comment';
  1807. var pi = 'xml-pe';
  1808. var pragma = 'constant.buildin';
  1809. var n = function(name){
  1810. return '\'' + name + '\'';
  1811. };
  1812. var Rules = {
  1813. start: [
  1814. { name: n('(#'), token: pragma, next: function(stack){ stack.push('Pragma'); } },
  1815. { name: n('(:'), token: 'comment', next: function(stack){ stack.push('Comment'); } },
  1816. { name: n('(:~'), token: 'comment.doc', next: function(stack){ stack.push('CommentDoc'); } },
  1817. { name: n('<!--'), token: xmlcomment, next: function(stack){ stack.push('XMLComment'); } },
  1818. { name: n('<?'), token: pi, next: function(stack) { stack.push('PI'); } },
  1819. { name: n('\'\''), token: 'string', next: function(stack){ stack.push('AposString'); } },
  1820. { name: n('"'), token: 'string', next: function(stack){ stack.push('QuotString'); } },
  1821. { name: 'Annotation', token: 'support.function' },
  1822. { name: 'ModuleDecl', token: 'keyword', next: function(stack){ stack.push('Prefix'); } },
  1823. { name: 'OptionDecl', token: 'keyword', next: function(stack){ stack.push('_EQName'); } },
  1824. { name: 'AttrTest', token: 'support.type' },
  1825. { name: 'Variable', token: 'variable' },
  1826. { name: n('<![CDATA['), token: cdata, next: function(stack){ stack.push('CData'); } },
  1827. { name: 'IntegerLiteral', token: number },
  1828. { name: 'DecimalLiteral', token: number },
  1829. { name: 'DoubleLiteral', token: number },
  1830. { name: 'Operator', token: 'keyword.operator' },
  1831. { name: 'EQName', token: function(val) { return keys.indexOf(val) !== -1 ? 'keyword' : 'support.function'; } },
  1832. { name: n('('), token: 'lparen' },
  1833. { name: n(')'), token: 'rparen' },
  1834. { name: 'Tag', token: 'meta.tag', next: function(stack){ stack.push('StartTag'); } },
  1835. { name: n('}'), token: 'text', next: function(stack){ if(stack.length > 1) { stack.pop(); } } },
  1836. { name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } } //, next: function(stack){ if(stack.length > 1) { stack.pop(); } } }
  1837. ].concat(keywords),
  1838. _EQName: [
  1839. { name: 'EQName', token: 'text', next: function(stack) { stack.pop(); } }
  1840. ].concat(ncnames),
  1841. Prefix: [
  1842. { name: 'NCName', token: 'text', next: function(stack) { stack.pop(); } }
  1843. ].concat(ncnames),
  1844. StartTag: [
  1845. { name: n('>'), token: 'meta.tag', next: function(stack){ stack.push('TagContent'); } },
  1846. { name: 'QName', token: 'entity.other.attribute-name' },
  1847. { name: n('='), token: 'text' },
  1848. { name: n('\'\''), token: 'string', next: function(stack){ stack.push('AposAttr'); } },
  1849. { name: n('"'), token: 'string', next: function(stack){ stack.push('QuotAttr'); } },
  1850. { name: n('/>'), token: 'meta.tag.r', next: function(stack){ stack.pop(); } }
  1851. ],
  1852. TagContent: [
  1853. { name: 'ElementContentChar', token: 'text' },
  1854. { name: n('<![CDATA['), token: cdata, next: function(stack){ stack.push('CData'); } },
  1855. { name: n('<!--'), token: xmlcomment, next: function(stack){ stack.push('XMLComment'); } },
  1856. { name: 'Tag', token: 'meta.tag', next: function(stack){ stack.push('StartTag'); } },
  1857. { name: 'PredefinedEntityRef', token: 'constant.language.escape' },
  1858. { name: 'CharRef', token: 'constant.language.escape' },
  1859. { name: n('{{'), token: 'text' },
  1860. { name: n('}}'), token: 'text' },
  1861. { name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } },
  1862. { name: 'EndTag', token: 'meta.tag', next: function(stack){ stack.pop(); stack.pop(); } }
  1863. ],
  1864. AposAttr: [
  1865. { name: n('\'\''), token: 'string', next: function(stack){ stack.pop(); } },
  1866. { name: 'EscapeApos', token: 'constant.language.escape' },
  1867. { name: 'AposAttrContentChar', token: 'string' },
  1868. { name: 'PredefinedEntityRef', token: 'constant.language.escape' },
  1869. { name: 'CharRef', token: 'constant.language.escape' },
  1870. { name: n('{{'), token: 'string' },
  1871. { name: n('}}'), token: 'string' },
  1872. { name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } }
  1873. ],
  1874. QuotAttr: [
  1875. { name: n('\"'), token: 'string', next: function(stack){ stack.pop(); } },
  1876. { name: 'EscapeQuot', token: 'constant.language.escape' },
  1877. { name: 'QuotAttrContentChar', token: 'string' },
  1878. { name: 'PredefinedEntityRef', token: 'constant.language.escape' },
  1879. { name: 'CharRef', token: 'constant.language.escape' },
  1880. { name: n('{{'), token: 'string' },
  1881. { name: n('}}'), token: 'string' },
  1882. { name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } }
  1883. ],
  1884. Pragma: [
  1885. { name: 'PragmaContents', token: pragma },
  1886. { name: n('#'), token: pragma },
  1887. { name: n('#)'), token: pragma, next: function(stack){ stack.pop(); } }
  1888. ],
  1889. Comment: [
  1890. { name: 'CommentContents', token: 'comment' },
  1891. { name: n('(:'), token: 'comment', next: function(stack){ stack.push('Comment'); } },
  1892. { name: n(':)'), token: 'comment', next: function(stack){ stack.pop(); } }
  1893. ],
  1894. CommentDoc: [
  1895. { name: 'DocCommentContents', token: 'comment.doc' },
  1896. { name: 'DocTag', token: 'comment.doc.tag' },
  1897. { name: n('(:'), token: 'comment.doc', next: function(stack){ stack.push('CommentDoc'); } },
  1898. { name: n(':)'), token: 'comment.doc', next: function(stack){ stack.pop(); } }
  1899. ],
  1900. XMLComment: [
  1901. { name: 'DirCommentContents', token: xmlcomment },
  1902. { name: n('-->'), token: xmlcomment, next: function(stack){ stack.pop(); } }
  1903. ],
  1904. CData: [
  1905. { name: 'CDataSectionContents', token: cdata },
  1906. { name: n(']]>'), token: cdata, next: function(stack){ stack.pop(); } }
  1907. ],
  1908. PI: [
  1909. { name: 'DirPIContents', token: pi },
  1910. { name: n('?'), token: pi },
  1911. { name: n('?>'), token: pi, next: function(stack){ stack.pop(); } }
  1912. ],
  1913. AposString: [
  1914. { name: n('\'\''), token: 'string', next: function(stack){ stack.pop(); } },
  1915. { name: 'PredefinedEntityRef', token: 'constant.language.escape' },
  1916. { name: 'CharRef', token: 'constant.language.escape' },
  1917. { name: 'EscapeApos', token: 'constant.language.escape' },
  1918. { name: 'AposChar', token: 'string' }
  1919. ],
  1920. QuotString: [
  1921. { name: n('"'), token: 'string', next: function(stack){ stack.pop(); } },
  1922. { name: 'JSONPredefinedCharRef', token: 'constant.language.escape' },
  1923. { name: 'JSONCharRef', token: 'constant.language.escape' },
  1924. { name: 'JSONChar', token: 'string' }
  1925. ]
  1926. };
  1927. exports.JSONiqLexer = function(){ return new Lexer(JSONiqTokenizer, Rules); };
  1928. },{"./JSONiqTokenizer":"/node_modules/xqlint/lib/lexers/JSONiqTokenizer.js","./lexer":"/node_modules/xqlint/lib/lexers/lexer.js"}],"/node_modules/xqlint/lib/lexers/lexer.js":[function(_dereq_,module,exports){
  1929. 'use strict';
  1930. var TokenHandler = function(code) {
  1931. var input = code;
  1932. this.tokens = [];
  1933. this.reset = function() {
  1934. input = input;
  1935. this.tokens = [];
  1936. };
  1937. this.startNonterminal = function() {};
  1938. this.endNonterminal = function() {};
  1939. this.terminal = function(name, begin, end) {
  1940. this.tokens.push({
  1941. name: name,
  1942. value: input.substring(begin, end)
  1943. });
  1944. };
  1945. this.whitespace = function(begin, end) {
  1946. this.tokens.push({
  1947. name: 'WS',
  1948. value: input.substring(begin, end)
  1949. });
  1950. };
  1951. };
  1952. exports.Lexer = function(Tokenizer, Rules) {
  1953. this.tokens = [];
  1954. this.getLineTokens = function(line, state) {
  1955. state = (state === 'start' || !state) ? '["start"]' : state;
  1956. var stack = JSON.parse(state);
  1957. var h = new TokenHandler(line);
  1958. var tokenizer = new Tokenizer(line, h);
  1959. var tokens = [];
  1960. while(true) {
  1961. var currentState = stack[stack.length - 1];
  1962. try {
  1963. h.tokens = [];
  1964. tokenizer['parse_' + currentState]();
  1965. var info = null;
  1966. if(h.tokens.length > 1 && h.tokens[0].name === 'WS') {
  1967. tokens.push({
  1968. type: 'text',
  1969. value: h.tokens[0].value
  1970. });
  1971. h.tokens.splice(0, 1);
  1972. }
  1973. var token = h.tokens[0];
  1974. var rules = Rules[currentState];
  1975. for(var k = 0; k < rules.length; k++) {
  1976. var rule = Rules[currentState][k];
  1977. if((typeof(rule.name) === 'function' && rule.name(token)) || rule.name === token.name) {
  1978. info = rule;
  1979. break;
  1980. }
  1981. }
  1982. if(token.name === 'EOF') { break; }
  1983. if(token.value === '') { throw 'Encountered empty string lexical rule.'; }
  1984. tokens.push({
  1985. type: info === null ? 'text' : (typeof(info.token) === 'function' ? info.token(token.value) : info.token),
  1986. value: token.value
  1987. });
  1988. if(info && info.next) {
  1989. info.next(stack);
  1990. }
  1991. } catch(e) {
  1992. if(e instanceof tokenizer.ParseException) {
  1993. var index = 0;
  1994. for(var i=0; i < tokens.length; i++) {
  1995. index += tokens[i].value.length;
  1996. }
  1997. tokens.push({ type: 'text', value: line.substring(index) });
  1998. return {
  1999. tokens: tokens,
  2000. state: JSON.stringify(['start'])
  2001. };
  2002. } else {
  2003. throw e;
  2004. }
  2005. }
  2006. }
  2007. return {
  2008. tokens: tokens,
  2009. state: JSON.stringify(stack)
  2010. };
  2011. };
  2012. };
  2013. },{}]},{},["/node_modules/xqlint/lib/lexers/jsoniq_lexer.js"]);
  2014. });
  2015. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
  2016. "use strict";
  2017. var oop = acequire("../../lib/oop");
  2018. var Behaviour = acequire("../behaviour").Behaviour;
  2019. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  2020. var lang = acequire("../../lib/lang");
  2021. function is(token, type) {
  2022. return token.type.lastIndexOf(type + ".xml") > -1;
  2023. }
  2024. var XmlBehaviour = function () {
  2025. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  2026. if (text == '"' || text == "'") {
  2027. var quote = text;
  2028. var selected = session.doc.getTextRange(editor.getSelectionRange());
  2029. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  2030. return {
  2031. text: quote + selected + quote,
  2032. selection: false
  2033. };
  2034. }
  2035. var cursor = editor.getCursorPosition();
  2036. var line = session.doc.getLine(cursor.row);
  2037. var rightChar = line.substring(cursor.column, cursor.column + 1);
  2038. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  2039. var token = iterator.getCurrentToken();
  2040. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  2041. return {
  2042. text: "",
  2043. selection: [1, 1]
  2044. };
  2045. }
  2046. if (!token)
  2047. token = iterator.stepBackward();
  2048. if (!token)
  2049. return;
  2050. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  2051. token = iterator.stepBackward();
  2052. }
  2053. var rightSpace = !rightChar || rightChar.match(/\s/);
  2054. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  2055. return {
  2056. text: quote + quote,
  2057. selection: [1, 1]
  2058. };
  2059. }
  2060. }
  2061. });
  2062. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  2063. var selected = session.doc.getTextRange(range);
  2064. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  2065. var line = session.doc.getLine(range.start.row);
  2066. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  2067. if (rightChar == selected) {
  2068. range.end.column++;
  2069. return range;
  2070. }
  2071. }
  2072. });
  2073. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  2074. if (text == '>') {
  2075. var position = editor.getSelectionRange().start;
  2076. var iterator = new TokenIterator(session, position.row, position.column);
  2077. var token = iterator.getCurrentToken() || iterator.stepBackward();
  2078. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  2079. return;
  2080. if (is(token, "reference.attribute-value"))
  2081. return;
  2082. if (is(token, "attribute-value")) {
  2083. var firstChar = token.value.charAt(0);
  2084. if (firstChar == '"' || firstChar == "'") {
  2085. var lastChar = token.value.charAt(token.value.length - 1);
  2086. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  2087. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  2088. return;
  2089. }
  2090. }
  2091. while (!is(token, "tag-name")) {
  2092. token = iterator.stepBackward();
  2093. if (token.value == "<") {
  2094. token = iterator.stepForward();
  2095. break;
  2096. }
  2097. }
  2098. var tokenRow = iterator.getCurrentTokenRow();
  2099. var tokenColumn = iterator.getCurrentTokenColumn();
  2100. if (is(iterator.stepBackward(), "end-tag-open"))
  2101. return;
  2102. var element = token.value;
  2103. if (tokenRow == position.row)
  2104. element = element.substring(0, position.column - tokenColumn);
  2105. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  2106. return;
  2107. return {
  2108. text: ">" + "</" + element + ">",
  2109. selection: [1, 1]
  2110. };
  2111. }
  2112. });
  2113. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  2114. if (text == "\n") {
  2115. var cursor = editor.getCursorPosition();
  2116. var line = session.getLine(cursor.row);
  2117. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  2118. var token = iterator.getCurrentToken();
  2119. if (token && token.type.indexOf("tag-close") !== -1) {
  2120. if (token.value == "/>")
  2121. return;
  2122. while (token && token.type.indexOf("tag-name") === -1) {
  2123. token = iterator.stepBackward();
  2124. }
  2125. if (!token) {
  2126. return;
  2127. }
  2128. var tag = token.value;
  2129. var row = iterator.getCurrentTokenRow();
  2130. token = iterator.stepBackward();
  2131. if (!token || token.type.indexOf("end-tag") !== -1) {
  2132. return;
  2133. }
  2134. if (this.voidElements && !this.voidElements[tag]) {
  2135. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  2136. var line = session.getLine(row);
  2137. var nextIndent = this.$getIndent(line);
  2138. var indent = nextIndent + session.getTabString();
  2139. if (nextToken && nextToken.value === "</") {
  2140. return {
  2141. text: "\n" + indent + "\n" + nextIndent,
  2142. selection: [1, indent.length, 1, indent.length]
  2143. };
  2144. } else {
  2145. return {
  2146. text: "\n" + indent
  2147. };
  2148. }
  2149. }
  2150. }
  2151. }
  2152. });
  2153. };
  2154. oop.inherits(XmlBehaviour, Behaviour);
  2155. exports.XmlBehaviour = XmlBehaviour;
  2156. });
  2157. ace.define("ace/mode/behaviour/xquery",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/mode/behaviour/xml","ace/token_iterator"], function(acequire, exports, module) {
  2158. "use strict";
  2159. var oop = acequire("../../lib/oop");
  2160. var Behaviour = acequire('../behaviour').Behaviour;
  2161. var CstyleBehaviour = acequire('./cstyle').CstyleBehaviour;
  2162. var XmlBehaviour = acequire("../behaviour/xml").XmlBehaviour;
  2163. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  2164. function hasType(token, type) {
  2165. var hasType = true;
  2166. var typeList = token.type.split('.');
  2167. var needleList = type.split('.');
  2168. needleList.forEach(function(needle){
  2169. if (typeList.indexOf(needle) == -1) {
  2170. hasType = false;
  2171. return false;
  2172. }
  2173. });
  2174. return hasType;
  2175. }
  2176. var XQueryBehaviour = function () {
  2177. this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
  2178. this.inherit(XmlBehaviour); // Get xml behaviour
  2179. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  2180. if (text == '>') {
  2181. var position = editor.getCursorPosition();
  2182. var iterator = new TokenIterator(session, position.row, position.column);
  2183. var token = iterator.getCurrentToken();
  2184. var atCursor = false;
  2185. var state = JSON.parse(state).pop();
  2186. if ((token && token.value === '>') || state !== "StartTag") return;
  2187. if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
  2188. do {
  2189. token = iterator.stepBackward();
  2190. } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
  2191. } else {
  2192. atCursor = true;
  2193. }
  2194. var previous = iterator.stepBackward();
  2195. if (!token || !hasType(token, 'meta.tag') || (previous !== null && previous.value.match('/'))) {
  2196. return;
  2197. }
  2198. var tag = token.value.substring(1);
  2199. if (atCursor){
  2200. var tag = tag.substring(0, position.column - token.start);
  2201. }
  2202. return {
  2203. text: '>' + '</' + tag + '>',
  2204. selection: [1, 1]
  2205. };
  2206. }
  2207. });
  2208. };
  2209. oop.inherits(XQueryBehaviour, Behaviour);
  2210. exports.XQueryBehaviour = XQueryBehaviour;
  2211. });
  2212. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  2213. "use strict";
  2214. var oop = acequire("../../lib/oop");
  2215. var Range = acequire("../../range").Range;
  2216. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  2217. var FoldMode = exports.FoldMode = function(commentRegex) {
  2218. if (commentRegex) {
  2219. this.foldingStartMarker = new RegExp(
  2220. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  2221. );
  2222. this.foldingStopMarker = new RegExp(
  2223. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  2224. );
  2225. }
  2226. };
  2227. oop.inherits(FoldMode, BaseFoldMode);
  2228. (function() {
  2229. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  2230. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  2231. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  2232. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  2233. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  2234. this._getFoldWidgetBase = this.getFoldWidget;
  2235. this.getFoldWidget = function(session, foldStyle, row) {
  2236. var line = session.getLine(row);
  2237. if (this.singleLineBlockCommentRe.test(line)) {
  2238. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  2239. return "";
  2240. }
  2241. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  2242. if (!fw && this.startRegionRe.test(line))
  2243. return "start"; // lineCommentRegionStart
  2244. return fw;
  2245. };
  2246. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  2247. var line = session.getLine(row);
  2248. if (this.startRegionRe.test(line))
  2249. return this.getCommentRegionBlock(session, line, row);
  2250. var match = line.match(this.foldingStartMarker);
  2251. if (match) {
  2252. var i = match.index;
  2253. if (match[1])
  2254. return this.openingBracketBlock(session, match[1], row, i);
  2255. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  2256. if (range && !range.isMultiLine()) {
  2257. if (forceMultiline) {
  2258. range = this.getSectionRange(session, row);
  2259. } else if (foldStyle != "all")
  2260. range = null;
  2261. }
  2262. return range;
  2263. }
  2264. if (foldStyle === "markbegin")
  2265. return;
  2266. var match = line.match(this.foldingStopMarker);
  2267. if (match) {
  2268. var i = match.index + match[0].length;
  2269. if (match[1])
  2270. return this.closingBracketBlock(session, match[1], row, i);
  2271. return session.getCommentFoldRange(row, i, -1);
  2272. }
  2273. };
  2274. this.getSectionRange = function(session, row) {
  2275. var line = session.getLine(row);
  2276. var startIndent = line.search(/\S/);
  2277. var startRow = row;
  2278. var startColumn = line.length;
  2279. row = row + 1;
  2280. var endRow = row;
  2281. var maxRow = session.getLength();
  2282. while (++row < maxRow) {
  2283. line = session.getLine(row);
  2284. var indent = line.search(/\S/);
  2285. if (indent === -1)
  2286. continue;
  2287. if (startIndent > indent)
  2288. break;
  2289. var subRange = this.getFoldWidgetRange(session, "all", row);
  2290. if (subRange) {
  2291. if (subRange.start.row <= startRow) {
  2292. break;
  2293. } else if (subRange.isMultiLine()) {
  2294. row = subRange.end.row;
  2295. } else if (startIndent == indent) {
  2296. break;
  2297. }
  2298. }
  2299. endRow = row;
  2300. }
  2301. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  2302. };
  2303. this.getCommentRegionBlock = function(session, line, row) {
  2304. var startColumn = line.search(/\s*$/);
  2305. var maxRow = session.getLength();
  2306. var startRow = row;
  2307. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  2308. var depth = 1;
  2309. while (++row < maxRow) {
  2310. line = session.getLine(row);
  2311. var m = re.exec(line);
  2312. if (!m) continue;
  2313. if (m[1]) depth--;
  2314. else depth++;
  2315. if (!depth) break;
  2316. }
  2317. var endRow = row;
  2318. if (endRow > startRow) {
  2319. return new Range(startRow, startColumn, endRow, line.length);
  2320. }
  2321. };
  2322. }).call(FoldMode.prototype);
  2323. });
  2324. ace.define("ace/mode/jsoniq",["require","exports","module","ace/worker/worker_client","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/xquery/jsoniq_lexer","ace/range","ace/mode/behaviour/xquery","ace/mode/folding/cstyle","ace/anchor"], function(acequire, exports, module) {
  2325. "use strict";
  2326. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  2327. var oop = acequire("../lib/oop");
  2328. var TextMode = acequire("./text").Mode;
  2329. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  2330. var JSONiqLexer = acequire("./xquery/jsoniq_lexer").JSONiqLexer;
  2331. var Range = acequire("../range").Range;
  2332. var XQueryBehaviour = acequire("./behaviour/xquery").XQueryBehaviour;
  2333. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  2334. var Anchor = acequire("../anchor").Anchor;
  2335. var Mode = function() {
  2336. this.$tokenizer = new JSONiqLexer();
  2337. this.$behaviour = new XQueryBehaviour();
  2338. this.foldingRules = new CStyleFoldMode();
  2339. this.$highlightRules = new TextHighlightRules();
  2340. };
  2341. oop.inherits(Mode, TextMode);
  2342. (function() {
  2343. this.completer = {
  2344. getCompletions: function(editor, session, pos, prefix, callback) {
  2345. if (!session.$worker)
  2346. return callback();
  2347. session.$worker.emit("complete", { data: { pos: pos, prefix: prefix } });
  2348. session.$worker.on("complete", function(e){
  2349. callback(null, e.data);
  2350. });
  2351. }
  2352. };
  2353. this.getNextLineIndent = function(state, line, tab) {
  2354. var indent = this.$getIndent(line);
  2355. var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
  2356. if (match)
  2357. indent += tab;
  2358. return indent;
  2359. };
  2360. this.checkOutdent = function(state, line, input) {
  2361. if (! /^\s+$/.test(line))
  2362. return false;
  2363. return /^\s*[\}\)]/.test(input);
  2364. };
  2365. this.autoOutdent = function(state, doc, row) {
  2366. var line = doc.getLine(row);
  2367. var match = line.match(/^(\s*[\}\)])/);
  2368. if (!match) return 0;
  2369. var column = match[1].length;
  2370. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  2371. if (!openBracePos || openBracePos.row == row) return 0;
  2372. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  2373. doc.replace(new Range(row, 0, row, column-1), indent);
  2374. };
  2375. this.toggleCommentLines = function(state, doc, startRow, endRow) {
  2376. var i, line;
  2377. var outdent = true;
  2378. var re = /^\s*\(:(.*):\)/;
  2379. for (i=startRow; i<= endRow; i++) {
  2380. if (!re.test(doc.getLine(i))) {
  2381. outdent = false;
  2382. break;
  2383. }
  2384. }
  2385. var range = new Range(0, 0, 0, 0);
  2386. for (i=startRow; i<= endRow; i++) {
  2387. line = doc.getLine(i);
  2388. range.start.row = i;
  2389. range.end.row = i;
  2390. range.end.column = line.length;
  2391. doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
  2392. }
  2393. };
  2394. this.createWorker = function(session) {
  2395. var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker");
  2396. var that = this;
  2397. worker.attachToDocument(session.getDocument());
  2398. worker.on("ok", function(e) {
  2399. session.clearAnnotations();
  2400. });
  2401. worker.on("markers", function(e) {
  2402. session.clearAnnotations();
  2403. that.addMarkers(e.data, session);
  2404. });
  2405. return worker;
  2406. };
  2407. this.removeMarkers = function(session) {
  2408. var markers = session.getMarkers(false);
  2409. for (var id in markers) {
  2410. if (markers[id].clazz.indexOf('language_highlight_') === 0) {
  2411. session.removeMarker(id);
  2412. }
  2413. }
  2414. for (var i = 0; i < session.markerAnchors.length; i++) {
  2415. session.markerAnchors[i].detach();
  2416. }
  2417. session.markerAnchors = [];
  2418. };
  2419. this.addMarkers = function(annos, mySession) {
  2420. var _self = this;
  2421. if (!mySession.markerAnchors) mySession.markerAnchors = [];
  2422. this.removeMarkers(mySession);
  2423. mySession.languageAnnos = [];
  2424. annos.forEach(function(anno) {
  2425. var anchor = new Anchor(mySession.getDocument(), anno.pos.sl, anno.pos.sc || 0);
  2426. mySession.markerAnchors.push(anchor);
  2427. var markerId;
  2428. var colDiff = anno.pos.ec - anno.pos.sc;
  2429. var rowDiff = anno.pos.el - anno.pos.sl;
  2430. var gutterAnno = {
  2431. guttertext: anno.message,
  2432. type: anno.level || "warning",
  2433. text: anno.message
  2434. };
  2435. function updateFloat(single) {
  2436. if (markerId)
  2437. mySession.removeMarker(markerId);
  2438. gutterAnno.row = anchor.row;
  2439. if (anno.pos.sc !== undefined && anno.pos.ec !== undefined) {
  2440. var range = new Range(anno.pos.sl, anno.pos.sc, anno.pos.el, anno.pos.ec);
  2441. markerId = mySession.addMarker(range, "language_highlight_" + (anno.type ? anno.type : "default"));
  2442. }
  2443. if (single) mySession.setAnnotations(mySession.languageAnnos);
  2444. }
  2445. updateFloat();
  2446. anchor.on("change", function() {
  2447. updateFloat(true);
  2448. });
  2449. if (anno.message) mySession.languageAnnos.push(gutterAnno);
  2450. });
  2451. mySession.setAnnotations(mySession.languageAnnos);
  2452. };
  2453. this.$id = "ace/mode/jsoniq";
  2454. }).call(Mode.prototype);
  2455. exports.Mode = Mode;
  2456. });