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

2644 lines
318 KiB
JavaScript

define("ace/mode/xquery/xquery_lexer",["require","exports","module"], function(require, exports, module) {
module.exports = (function outer (modules, cache, entry) {
var previousRequire = typeof require == "function" && require;
function newRequire(name, jumped){
if(!cache[name]) {
if(!modules[name]) {
var currentRequire = typeof require == "function" && require;
if (!jumped && currentRequire) return currentRequire(name, true);
if (previousRequire) return previousRequire(name, true);
var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}
var m = cache[name] = {exports:{}};
modules[name][0].call(m.exports, function(x){
var id = modules[name][1][x];
return newRequire(id ? id : x);
},m,m.exports,outer,modules,cache,entry);
}
return cache[name].exports;
}
for(var i=0;i<entry.length;i++) newRequire(entry[i]);
return newRequire(entry[0]);
})
({"/node_modules/xqlint/lib/lexers/XQueryTokenizer.js":[function(_dereq_,module,exports){
var XQueryTokenizer = exports.XQueryTokenizer = function XQueryTokenizer(string, parsingEventHandler)
{
init(string, parsingEventHandler);
var self = this;
this.ParseException = function(b, e, s, o, x)
{
var
begin = b,
end = e,
state = s,
offending = o,
expected = x;
this.getBegin = function() {return begin;};
this.getEnd = function() {return end;};
this.getState = function() {return state;};
this.getExpected = function() {return expected;};
this.getOffending = function() {return offending;};
this.getMessage = function()
{
return offending < 0 ? "lexical analysis failed" : "syntax error";
};
};
function init(string, parsingEventHandler)
{
eventHandler = parsingEventHandler;
input = string;
size = string.length;
reset(0, 0, 0);
}
this.getInput = function()
{
return input;
};
function reset(l, b, e)
{
b0 = b; e0 = b;
l1 = l; b1 = b; e1 = e;
end = e;
eventHandler.reset(input);
}
this.getOffendingToken = function(e)
{
var o = e.getOffending();
return o >= 0 ? XQueryTokenizer.TOKEN[o] : null;
};
this.getExpectedTokenSet = function(e)
{
var expected;
if (e.getExpected() < 0)
{
expected = XQueryTokenizer.getTokenSet(- e.getState());
}
else
{
expected = [XQueryTokenizer.TOKEN[e.getExpected()]];
}
return expected;
};
this.getErrorMessage = function(e)
{
var tokenSet = this.getExpectedTokenSet(e);
var found = this.getOffendingToken(e);
var prefix = input.substring(0, e.getBegin());
var lines = prefix.split("\n");
var line = lines.length;
var column = lines[line - 1].length + 1;
var size = e.getEnd() - e.getBegin();
return e.getMessage()
+ (found == null ? "" : ", found " + found)
+ "\nwhile expecting "
+ (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]"))
+ "\n"
+ (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ")
+ "at line " + line + ", column " + column + ":\n..."
+ input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64))
+ "...";
};
this.parse_start = function()
{
eventHandler.startNonterminal("start", e0);
lookahead1W(14); // ModuleDecl | Annotation | OptionDecl | Operator | Variable | Tag | AttrTest |
switch (l1)
{
case 55: // '<![CDATA['
shift(55); // '<![CDATA['
break;
case 54: // '<!--'
shift(54); // '<!--'
break;
case 56: // '<?'
shift(56); // '<?'
break;
case 40: // '(#'
shift(40); // '(#'
break;
case 42: // '(:~'
shift(42); // '(:~'
break;
case 41: // '(:'
shift(41); // '(:'
break;
case 35: // '"'
shift(35); // '"'
break;
case 38: // "'"
shift(38); // "'"
break;
case 274: // '}'
shift(274); // '}'
break;
case 271: // '{'
shift(271); // '{'
break;
case 39: // '('
shift(39); // '('
break;
case 43: // ')'
shift(43); // ')'
break;
case 49: // '/'
shift(49); // '/'
break;
case 62: // '['
shift(62); // '['
break;
case 63: // ']'
shift(63); // ']'
break;
case 46: // ','
shift(46); // ','
break;
case 48: // '.'
shift(48); // '.'
break;
case 53: // ';'
shift(53); // ';'
break;
case 51: // ':'
shift(51); // ':'
break;
case 34: // '!'
shift(34); // '!'
break;
case 273: // '|'
shift(273); // '|'
break;
case 2: // Annotation
shift(2); // Annotation
break;
case 1: // ModuleDecl
shift(1); // ModuleDecl
break;
case 3: // OptionDecl
shift(3); // OptionDecl
break;
case 12: // AttrTest
shift(12); // AttrTest
break;
case 13: // Wildcard
shift(13); // Wildcard
break;
case 15: // IntegerLiteral
shift(15); // IntegerLiteral
break;
case 16: // DecimalLiteral
shift(16); // DecimalLiteral
break;
case 17: // DoubleLiteral
shift(17); // DoubleLiteral
break;
case 5: // Variable
shift(5); // Variable
break;
case 6: // Tag
shift(6); // Tag
break;
case 4: // Operator
shift(4); // Operator
break;
case 33: // EOF
shift(33); // EOF
break;
default:
parse_EQName();
}
eventHandler.endNonterminal("start", e0);
};
this.parse_StartTag = function()
{
eventHandler.startNonterminal("StartTag", e0);
lookahead1W(8); // QName | S^WS | EOF | '"' | "'" | '/>' | '=' | '>'
switch (l1)
{
case 58: // '>'
shift(58); // '>'
break;
case 50: // '/>'
shift(50); // '/>'
break;
case 27: // QName
shift(27); // QName
break;
case 57: // '='
shift(57); // '='
break;
case 35: // '"'
shift(35); // '"'
break;
case 38: // "'"
shift(38); // "'"
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("StartTag", e0);
};
this.parse_TagContent = function()
{
eventHandler.startNonterminal("TagContent", e0);
lookahead1(11); // Tag | EndTag | PredefinedEntityRef | ElementContentChar | CharRef | EOF |
switch (l1)
{
case 23: // ElementContentChar
shift(23); // ElementContentChar
break;
case 6: // Tag
shift(6); // Tag
break;
case 7: // EndTag
shift(7); // EndTag
break;
case 55: // '<![CDATA['
shift(55); // '<![CDATA['
break;
case 54: // '<!--'
shift(54); // '<!--'
break;
case 18: // PredefinedEntityRef
shift(18); // PredefinedEntityRef
break;
case 29: // CharRef
shift(29); // CharRef
break;
case 272: // '{{'
shift(272); // '{{'
break;
case 275: // '}}'
shift(275); // '}}'
break;
case 271: // '{'
shift(271); // '{'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("TagContent", e0);
};
this.parse_AposAttr = function()
{
eventHandler.startNonterminal("AposAttr", e0);
lookahead1(10); // PredefinedEntityRef | EscapeApos | AposAttrContentChar | CharRef | EOF | "'" |
switch (l1)
{
case 20: // EscapeApos
shift(20); // EscapeApos
break;
case 25: // AposAttrContentChar
shift(25); // AposAttrContentChar
break;
case 18: // PredefinedEntityRef
shift(18); // PredefinedEntityRef
break;
case 29: // CharRef
shift(29); // CharRef
break;
case 272: // '{{'
shift(272); // '{{'
break;
case 275: // '}}'
shift(275); // '}}'
break;
case 271: // '{'
shift(271); // '{'
break;
case 38: // "'"
shift(38); // "'"
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("AposAttr", e0);
};
this.parse_QuotAttr = function()
{
eventHandler.startNonterminal("QuotAttr", e0);
lookahead1(9); // PredefinedEntityRef | EscapeQuot | QuotAttrContentChar | CharRef | EOF | '"' |
switch (l1)
{
case 19: // EscapeQuot
shift(19); // EscapeQuot
break;
case 24: // QuotAttrContentChar
shift(24); // QuotAttrContentChar
break;
case 18: // PredefinedEntityRef
shift(18); // PredefinedEntityRef
break;
case 29: // CharRef
shift(29); // CharRef
break;
case 272: // '{{'
shift(272); // '{{'
break;
case 275: // '}}'
shift(275); // '}}'
break;
case 271: // '{'
shift(271); // '{'
break;
case 35: // '"'
shift(35); // '"'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("QuotAttr", e0);
};
this.parse_CData = function()
{
eventHandler.startNonterminal("CData", e0);
lookahead1(1); // CDataSectionContents | EOF | ']]>'
switch (l1)
{
case 11: // CDataSectionContents
shift(11); // CDataSectionContents
break;
case 64: // ']]>'
shift(64); // ']]>'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("CData", e0);
};
this.parse_XMLComment = function()
{
eventHandler.startNonterminal("XMLComment", e0);
lookahead1(0); // DirCommentContents | EOF | '-->'
switch (l1)
{
case 9: // DirCommentContents
shift(9); // DirCommentContents
break;
case 47: // '-->'
shift(47); // '-->'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("XMLComment", e0);
};
this.parse_PI = function()
{
eventHandler.startNonterminal("PI", e0);
lookahead1(3); // DirPIContents | EOF | '?' | '?>'
switch (l1)
{
case 10: // DirPIContents
shift(10); // DirPIContents
break;
case 59: // '?'
shift(59); // '?'
break;
case 60: // '?>'
shift(60); // '?>'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("PI", e0);
};
this.parse_Pragma = function()
{
eventHandler.startNonterminal("Pragma", e0);
lookahead1(2); // PragmaContents | EOF | '#' | '#)'
switch (l1)
{
case 8: // PragmaContents
shift(8); // PragmaContents
break;
case 36: // '#'
shift(36); // '#'
break;
case 37: // '#)'
shift(37); // '#)'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("Pragma", e0);
};
this.parse_Comment = function()
{
eventHandler.startNonterminal("Comment", e0);
lookahead1(4); // CommentContents | EOF | '(:' | ':)'
switch (l1)
{
case 52: // ':)'
shift(52); // ':)'
break;
case 41: // '(:'
shift(41); // '(:'
break;
case 30: // CommentContents
shift(30); // CommentContents
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("Comment", e0);
};
this.parse_CommentDoc = function()
{
eventHandler.startNonterminal("CommentDoc", e0);
lookahead1(5); // DocTag | DocCommentContents | EOF | '(:' | ':)'
switch (l1)
{
case 31: // DocTag
shift(31); // DocTag
break;
case 32: // DocCommentContents
shift(32); // DocCommentContents
break;
case 52: // ':)'
shift(52); // ':)'
break;
case 41: // '(:'
shift(41); // '(:'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("CommentDoc", e0);
};
this.parse_QuotString = function()
{
eventHandler.startNonterminal("QuotString", e0);
lookahead1(6); // PredefinedEntityRef | EscapeQuot | QuotChar | CharRef | EOF | '"'
switch (l1)
{
case 18: // PredefinedEntityRef
shift(18); // PredefinedEntityRef
break;
case 29: // CharRef
shift(29); // CharRef
break;
case 19: // EscapeQuot
shift(19); // EscapeQuot
break;
case 21: // QuotChar
shift(21); // QuotChar
break;
case 35: // '"'
shift(35); // '"'
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("QuotString", e0);
};
this.parse_AposString = function()
{
eventHandler.startNonterminal("AposString", e0);
lookahead1(7); // PredefinedEntityRef | EscapeApos | AposChar | CharRef | EOF | "'"
switch (l1)
{
case 18: // PredefinedEntityRef
shift(18); // PredefinedEntityRef
break;
case 29: // CharRef
shift(29); // CharRef
break;
case 20: // EscapeApos
shift(20); // EscapeApos
break;
case 22: // AposChar
shift(22); // AposChar
break;
case 38: // "'"
shift(38); // "'"
break;
default:
shift(33); // EOF
}
eventHandler.endNonterminal("AposString", e0);
};
this.parse_Prefix = function()
{
eventHandler.startNonterminal("Prefix", e0);
lookahead1W(13); // NCName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
whitespace();
parse_NCName();
eventHandler.endNonterminal("Prefix", e0);
};
this.parse__EQName = function()
{
eventHandler.startNonterminal("_EQName", e0);
lookahead1W(12); // EQName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
whitespace();
parse_EQName();
eventHandler.endNonterminal("_EQName", e0);
};
function parse_EQName()
{
eventHandler.startNonterminal("EQName", e0);
switch (l1)
{
case 77: // 'attribute'
shift(77); // 'attribute'
break;
case 91: // 'comment'
shift(91); // 'comment'
break;
case 115: // 'document-node'
shift(115); // 'document-node'
break;
case 116: // 'element'
shift(116); // 'element'
break;
case 119: // 'empty-sequence'
shift(119); // 'empty-sequence'
break;
case 140: // 'function'
shift(140); // 'function'
break;
case 147: // 'if'
shift(147); // 'if'
break;
case 160: // 'item'
shift(160); // 'item'
break;
case 180: // 'namespace-node'
shift(180); // 'namespace-node'
break;
case 186: // 'node'
shift(186); // 'node'
break;
case 211: // 'processing-instruction'
shift(211); // 'processing-instruction'
break;
case 221: // 'schema-attribute'
shift(221); // 'schema-attribute'
break;
case 222: // 'schema-element'
shift(222); // 'schema-element'
break;
case 238: // 'switch'
shift(238); // 'switch'
break;
case 239: // 'text'
shift(239); // 'text'
break;
case 248: // 'typeswitch'
shift(248); // 'typeswitch'
break;
default:
parse_FunctionName();
}
eventHandler.endNonterminal("EQName", e0);
}
function parse_FunctionName()
{
eventHandler.startNonterminal("FunctionName", e0);
switch (l1)
{
case 14: // EQName^Token
shift(14); // EQName^Token
break;
case 65: // 'after'
shift(65); // 'after'
break;
case 68: // 'ancestor'
shift(68); // 'ancestor'
break;
case 69: // 'ancestor-or-self'
shift(69); // 'ancestor-or-self'
break;
case 70: // 'and'
shift(70); // 'and'
break;
case 74: // 'as'
shift(74); // 'as'
break;
case 75: // 'ascending'
shift(75); // 'ascending'
break;
case 79: // 'before'
shift(79); // 'before'
break;
case 83: // 'case'
shift(83); // 'case'
break;
case 84: // 'cast'
shift(84); // 'cast'
break;
case 85: // 'castable'
shift(85); // 'castable'
break;
case 88: // 'child'
shift(88); // 'child'
break;
case 89: // 'collation'
shift(89); // 'collation'
break;
case 98: // 'copy'
shift(98); // 'copy'
break;
case 100: // 'count'
shift(100); // 'count'
break;
case 103: // 'declare'
shift(103); // 'declare'
break;
case 104: // 'default'
shift(104); // 'default'
break;
case 105: // 'delete'
shift(105); // 'delete'
break;
case 106: // 'descendant'
shift(106); // 'descendant'
break;
case 107: // 'descendant-or-self'
shift(107); // 'descendant-or-self'
break;
case 108: // 'descending'
shift(108); // 'descending'
break;
case 113: // 'div'
shift(113); // 'div'
break;
case 114: // 'document'
shift(114); // 'document'
break;
case 117: // 'else'
shift(117); // 'else'
break;
case 118: // 'empty'
shift(118); // 'empty'
break;
case 121: // 'end'
shift(121); // 'end'
break;
case 123: // 'eq'
shift(123); // 'eq'
break;
case 124: // 'every'
shift(124); // 'every'
break;
case 126: // 'except'
shift(126); // 'except'
break;
case 129: // 'first'
shift(129); // 'first'
break;
case 130: // 'following'
shift(130); // 'following'
break;
case 131: // 'following-sibling'
shift(131); // 'following-sibling'
break;
case 132: // 'for'
shift(132); // 'for'
break;
case 141: // 'ge'
shift(141); // 'ge'
break;
case 143: // 'group'
shift(143); // 'group'
break;
case 145: // 'gt'
shift(145); // 'gt'
break;
case 146: // 'idiv'
shift(146); // 'idiv'
break;
case 148: // 'import'
shift(148); // 'import'
break;
case 154: // 'insert'
shift(154); // 'insert'
break;
case 155: // 'instance'
shift(155); // 'instance'
break;
case 157: // 'intersect'
shift(157); // 'intersect'
break;
case 158: // 'into'
shift(158); // 'into'
break;
case 159: // 'is'
shift(159); // 'is'
break;
case 165: // 'last'
shift(165); // 'last'
break;
case 167: // 'le'
shift(167); // 'le'
break;
case 169: // 'let'
shift(169); // 'let'
break;
case 173: // 'lt'
shift(173); // 'lt'
break;
case 175: // 'mod'
shift(175); // 'mod'
break;
case 176: // 'modify'
shift(176); // 'modify'
break;
case 177: // 'module'
shift(177); // 'module'
break;
case 179: // 'namespace'
shift(179); // 'namespace'
break;
case 181: // 'ne'
shift(181); // 'ne'
break;
case 193: // 'only'
shift(193); // 'only'
break;
case 195: // 'or'
shift(195); // 'or'
break;
case 196: // 'order'
shift(196); // 'order'
break;
case 197: // 'ordered'
shift(197); // 'ordered'
break;
case 201: // 'parent'
shift(201); // 'parent'
break;
case 207: // 'preceding'
shift(207); // 'preceding'
break;
case 208: // 'preceding-sibling'
shift(208); // 'preceding-sibling'
break;
case 213: // 'rename'
shift(213); // 'rename'
break;
case 214: // 'replace'
shift(214); // 'replace'
break;
case 215: // 'return'
shift(215); // 'return'
break;
case 219: // 'satisfies'
shift(219); // 'satisfies'
break;
case 224: // 'self'
shift(224); // 'self'
break;
case 230: // 'some'
shift(230); // 'some'
break;
case 231: // 'stable'
shift(231); // 'stable'
break;
case 232: // 'start'
shift(232); // 'start'
break;
case 243: // 'to'
shift(243); // 'to'
break;
case 244: // 'treat'
shift(244); // 'treat'
break;
case 245: // 'try'
shift(245); // 'try'
break;
case 249: // 'union'
shift(249); // 'union'
break;
case 251: // 'unordered'
shift(251); // 'unordered'
break;
case 255: // 'validate'
shift(255); // 'validate'
break;
case 261: // 'where'
shift(261); // 'where'
break;
case 265: // 'with'
shift(265); // 'with'
break;
case 269: // 'xquery'
shift(269); // 'xquery'
break;
case 67: // 'allowing'
shift(67); // 'allowing'
break;
case 76: // 'at'
shift(76); // 'at'
break;
case 78: // 'base-uri'
shift(78); // 'base-uri'
break;
case 80: // 'boundary-space'
shift(80); // 'boundary-space'
break;
case 81: // 'break'
shift(81); // 'break'
break;
case 86: // 'catch'
shift(86); // 'catch'
break;
case 93: // 'construction'
shift(93); // 'construction'
break;
case 96: // 'context'
shift(96); // 'context'
break;
case 97: // 'continue'
shift(97); // 'continue'
break;
case 99: // 'copy-namespaces'
shift(99); // 'copy-namespaces'
break;
case 101: // 'decimal-format'
shift(101); // 'decimal-format'
break;
case 120: // 'encoding'
shift(120); // 'encoding'
break;
case 127: // 'exit'
shift(127); // 'exit'
break;
case 128: // 'external'
shift(128); // 'external'
break;
case 136: // 'ft-option'
shift(136); // 'ft-option'
break;
case 149: // 'in'
shift(149); // 'in'
break;
case 150: // 'index'
shift(150); // 'index'
break;
case 156: // 'integrity'
shift(156); // 'integrity'
break;
case 166: // 'lax'
shift(166); // 'lax'
break;
case 187: // 'nodes'
shift(187); // 'nodes'
break;
case 194: // 'option'
shift(194); // 'option'
break;
case 198: // 'ordering'
shift(198); // 'ordering'
break;
case 217: // 'revalidation'
shift(217); // 'revalidation'
break;
case 220: // 'schema'
shift(220); // 'schema'
break;
case 223: // 'score'
shift(223); // 'score'
break;
case 229: // 'sliding'
shift(229); // 'sliding'
break;
case 235: // 'strict'
shift(235); // 'strict'
break;
case 246: // 'tumbling'
shift(246); // 'tumbling'
break;
case 247: // 'type'
shift(247); // 'type'
break;
case 252: // 'updating'
shift(252); // 'updating'
break;
case 256: // 'value'
shift(256); // 'value'
break;
case 257: // 'variable'
shift(257); // 'variable'
break;
case 258: // 'version'
shift(258); // 'version'
break;
case 262: // 'while'
shift(262); // 'while'
break;
case 92: // 'constraint'
shift(92); // 'constraint'
break;
case 171: // 'loop'
shift(171); // 'loop'
break;
default:
shift(216); // 'returning'
}
eventHandler.endNonterminal("FunctionName", e0);
}
function parse_NCName()
{
eventHandler.startNonterminal("NCName", e0);
switch (l1)
{
case 26: // NCName^Token
shift(26); // NCName^Token
break;
case 65: // 'after'
shift(65); // 'after'
break;
case 70: // 'and'
shift(70); // 'and'
break;
case 74: // 'as'
shift(74); // 'as'
break;
case 75: // 'ascending'
shift(75); // 'ascending'
break;
case 79: // 'before'
shift(79); // 'before'
break;
case 83: // 'case'
shift(83); // 'case'
break;
case 84: // 'cast'
shift(84); // 'cast'
break;
case 85: // 'castable'
shift(85); // 'castable'
break;
case 89: // 'collation'
shift(89); // 'collation'
break;
case 100: // 'count'
shift(100); // 'count'
break;
case 104: // 'default'
shift(104); // 'default'
break;
case 108: // 'descending'
shift(108); // 'descending'
break;
case 113: // 'div'
shift(113); // 'div'
break;
case 117: // 'else'
shift(117); // 'else'
break;
case 118: // 'empty'
shift(118); // 'empty'
break;
case 121: // 'end'
shift(121); // 'end'
break;
case 123: // 'eq'
shift(123); // 'eq'
break;
case 126: // 'except'
shift(126); // 'except'
break;
case 132: // 'for'
shift(132); // 'for'
break;
case 141: // 'ge'
shift(141); // 'ge'
break;
case 143: // 'group'
shift(143); // 'group'
break;
case 145: // 'gt'
shift(145); // 'gt'
break;
case 146: // 'idiv'
shift(146); // 'idiv'
break;
case 155: // 'instance'
shift(155); // 'instance'
break;
case 157: // 'intersect'
shift(157); // 'intersect'
break;
case 158: // 'into'
shift(158); // 'into'
break;
case 159: // 'is'
shift(159); // 'is'
break;
case 167: // 'le'
shift(167); // 'le'
break;
case 169: // 'let'
shift(169); // 'let'
break;
case 173: // 'lt'
shift(173); // 'lt'
break;
case 175: // 'mod'
shift(175); // 'mod'
break;
case 176: // 'modify'
shift(176); // 'modify'
break;
case 181: // 'ne'
shift(181); // 'ne'
break;
case 193: // 'only'
shift(193); // 'only'
break;
case 195: // 'or'
shift(195); // 'or'
break;
case 196: // 'order'
shift(196); // 'order'
break;
case 215: // 'return'
shift(215); // 'return'
break;
case 219: // 'satisfies'
shift(219); // 'satisfies'
break;
case 231: // 'stable'
shift(231); // 'stable'
break;
case 232: // 'start'
shift(232); // 'start'
break;
case 243: // 'to'
shift(243); // 'to'
break;
case 244: // 'treat'
shift(244); // 'treat'
break;
case 249: // 'union'
shift(249); // 'union'
break;
case 261: // 'where'
shift(261); // 'where'
break;
case 265: // 'with'
shift(265); // 'with'
break;
case 68: // 'ancestor'
shift(68); // 'ancestor'
break;
case 69: // 'ancestor-or-self'
shift(69); // 'ancestor-or-self'
break;
case 77: // 'attribute'
shift(77); // 'attribute'
break;
case 88: // 'child'
shift(88); // 'child'
break;
case 91: // 'comment'
shift(91); // 'comment'
break;
case 98: // 'copy'
shift(98); // 'copy'
break;
case 103: // 'declare'
shift(103); // 'declare'
break;
case 105: // 'delete'
shift(105); // 'delete'
break;
case 106: // 'descendant'
shift(106); // 'descendant'
break;
case 107: // 'descendant-or-self'
shift(107); // 'descendant-or-self'
break;
case 114: // 'document'
shift(114); // 'document'
break;
case 115: // 'document-node'
shift(115); // 'document-node'
break;
case 116: // 'element'
shift(116); // 'element'
break;
case 119: // 'empty-sequence'
shift(119); // 'empty-sequence'
break;
case 124: // 'every'
shift(124); // 'every'
break;
case 129: // 'first'
shift(129); // 'first'
break;
case 130: // 'following'
shift(130); // 'following'
break;
case 131: // 'following-sibling'
shift(131); // 'following-sibling'
break;
case 140: // 'function'
shift(140); // 'function'
break;
case 147: // 'if'
shift(147); // 'if'
break;
case 148: // 'import'
shift(148); // 'import'
break;
case 154: // 'insert'
shift(154); // 'insert'
break;
case 160: // 'item'
shift(160); // 'item'
break;
case 165: // 'last'
shift(165); // 'last'
break;
case 177: // 'module'
shift(177); // 'module'
break;
case 179: // 'namespace'
shift(179); // 'namespace'
break;
case 180: // 'namespace-node'
shift(180); // 'namespace-node'
break;
case 186: // 'node'
shift(186); // 'node'
break;
case 197: // 'ordered'
shift(197); // 'ordered'
break;
case 201: // 'parent'
shift(201); // 'parent'
break;
case 207: // 'preceding'
shift(207); // 'preceding'
break;
case 208: // 'preceding-sibling'
shift(208); // 'preceding-sibling'
break;
case 211: // 'processing-instruction'
shift(211); // 'processing-instruction'
break;
case 213: // 'rename'
shift(213); // 'rename'
break;
case 214: // 'replace'
shift(214); // 'replace'
break;
case 221: // 'schema-attribute'
shift(221); // 'schema-attribute'
break;
case 222: // 'schema-element'
shift(222); // 'schema-element'
break;
case 224: // 'self'
shift(224); // 'self'
break;
case 230: // 'some'
shift(230); // 'some'
break;
case 238: // 'switch'
shift(238); // 'switch'
break;
case 239: // 'text'
shift(239); // 'text'
break;
case 245: // 'try'
shift(245); // 'try'
break;
case 248: // 'typeswitch'
shift(248); // 'typeswitch'
break;
case 251: // 'unordered'
shift(251); // 'unordered'
break;
case 255: // 'validate'
shift(255); // 'validate'
break;
case 257: // 'variable'
shift(257); // 'variable'
break;
case 269: // 'xquery'
shift(269); // 'xquery'
break;
case 67: // 'allowing'
shift(67); // 'allowing'
break;
case 76: // 'at'
shift(76); // 'at'
break;
case 78: // 'base-uri'
shift(78); // 'base-uri'
break;
case 80: // 'boundary-space'
shift(80); // 'boundary-space'
break;
case 81: // 'break'
shift(81); // 'break'
break;
case 86: // 'catch'
shift(86); // 'catch'
break;
case 93: // 'construction'
shift(93); // 'construction'
break;
case 96: // 'context'
shift(96); // 'context'
break;
case 97: // 'continue'
shift(97); // 'continue'
break;
case 99: // 'copy-namespaces'
shift(99); // 'copy-namespaces'
break;
case 101: // 'decimal-format'
shift(101); // 'decimal-format'
break;
case 120: // 'encoding'
shift(120); // 'encoding'
break;
case 127: // 'exit'
shift(127); // 'exit'
break;
case 128: // 'external'
shift(128); // 'external'
break;
case 136: // 'ft-option'
shift(136); // 'ft-option'
break;
case 149: // 'in'
shift(149); // 'in'
break;
case 150: // 'index'
shift(150); // 'index'
break;
case 156: // 'integrity'
shift(156); // 'integrity'
break;
case 166: // 'lax'
shift(166); // 'lax'
break;
case 187: // 'nodes'
shift(187); // 'nodes'
break;
case 194: // 'option'
shift(194); // 'option'
break;
case 198: // 'ordering'
shift(198); // 'ordering'
break;
case 217: // 'revalidation'
shift(217); // 'revalidation'
break;
case 220: // 'schema'
shift(220); // 'schema'
break;
case 223: // 'score'
shift(223); // 'score'
break;
case 229: // 'sliding'
shift(229); // 'sliding'
break;
case 235: // 'strict'
shift(235); // 'strict'
break;
case 246: // 'tumbling'
shift(246); // 'tumbling'
break;
case 247: // 'type'
shift(247); // 'type'
break;
case 252: // 'updating'
shift(252); // 'updating'
break;
case 256: // 'value'
shift(256); // 'value'
break;
case 258: // 'version'
shift(258); // 'version'
break;
case 262: // 'while'
shift(262); // 'while'
break;
case 92: // 'constraint'
shift(92); // 'constraint'
break;
case 171: // 'loop'
shift(171); // 'loop'
break;
default:
shift(216); // 'returning'
}
eventHandler.endNonterminal("NCName", e0);
}
function shift(t)
{
if (l1 == t)
{
whitespace();
eventHandler.terminal(XQueryTokenizer.TOKEN[l1], b1, e1 > size ? size : e1);
b0 = b1; e0 = e1; l1 = 0;
}
else
{
error(b1, e1, 0, l1, t);
}
}
function whitespace()
{
if (e0 != b1)
{
b0 = e0;
e0 = b1;
eventHandler.whitespace(b0, e0);
}
}
function matchW(set)
{
var code;
for (;;)
{
code = match(set);
if (code != 28) // S^WS
{
break;
}
}
return code;
}
function lookahead1W(set)
{
if (l1 == 0)
{
l1 = matchW(set);
b1 = begin;
e1 = end;
}
}
function lookahead1(set)
{
if (l1 == 0)
{
l1 = match(set);
b1 = begin;
e1 = end;
}
}
function error(b, e, s, l, t)
{
throw new self.ParseException(b, e, s, l, t);
}
var lk, b0, e0;
var l1, b1, e1;
var eventHandler;
var input;
var size;
var begin;
var end;
function match(tokenSetId)
{
var nonbmp = false;
begin = end;
var current = end;
var result = XQueryTokenizer.INITIAL[tokenSetId];
var state = 0;
for (var code = result & 4095; code != 0; )
{
var charclass;
var c0 = current < size ? input.charCodeAt(current) : 0;
++current;
if (c0 < 0x80)
{
charclass = XQueryTokenizer.MAP0[c0];
}
else if (c0 < 0xd800)
{
var c1 = c0 >> 4;
charclass = XQueryTokenizer.MAP1[(c0 & 15) + XQueryTokenizer.MAP1[(c1 & 31) + XQueryTokenizer.MAP1[c1 >> 5]]];
}
else
{
if (c0 < 0xdc00)
{
var c1 = current < size ? input.charCodeAt(current) : 0;
if (c1 >= 0xdc00 && c1 < 0xe000)
{
++current;
c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000;
nonbmp = true;
}
}
var lo = 0, hi = 5;
for (var m = 3; ; m = (hi + lo) >> 1)
{
if (XQueryTokenizer.MAP2[m] > c0) hi = m - 1;
else if (XQueryTokenizer.MAP2[6 + m] < c0) lo = m + 1;
else {charclass = XQueryTokenizer.MAP2[12 + m]; break;}
if (lo > hi) {charclass = 0; break;}
}
}
state = code;
var i0 = (charclass << 12) + code - 1;
code = XQueryTokenizer.TRANSITION[(i0 & 15) + XQueryTokenizer.TRANSITION[i0 >> 4]];
if (code > 4095)
{
result = code;
code &= 4095;
end = current;
}
}
result >>= 12;
if (result == 0)
{
end = current - 1;
var c1 = end < size ? input.charCodeAt(end) : 0;
if (c1 >= 0xdc00 && c1 < 0xe000) --end;
return error(begin, end, state, -1, -1);
}
if (nonbmp)
{
for (var i = result >> 9; i > 0; --i)
{
--end;
var c1 = end < size ? input.charCodeAt(end) : 0;
if (c1 >= 0xdc00 && c1 < 0xe000) --end;
}
}
else
{
end -= result >> 9;
}
return (result & 511) - 1;
}
}
XQueryTokenizer.getTokenSet = function(tokenSetId)
{
var set = [];
var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095;
for (var i = 0; i < 276; i += 32)
{
var j = i;
var i0 = (i >> 5) * 2062 + s - 1;
var i1 = i0 >> 2;
var i2 = i1 >> 2;
var f = XQueryTokenizer.EXPECTED[(i0 & 3) + XQueryTokenizer.EXPECTED[(i1 & 3) + XQueryTokenizer.EXPECTED[(i2 & 3) + XQueryTokenizer.EXPECTED[i2 >> 2]]]];
for ( ; f != 0; f >>>= 1, ++j)
{
if ((f & 1) != 0)
{
set.push(XQueryTokenizer.TOKEN[j]);
}
}
}
return set;
};
XQueryTokenizer.MAP0 =
[ 66, 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, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35
];
XQueryTokenizer.MAP1 =
[ 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, 66, 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, 35, 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, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 31, 31, 35, 35, 35, 35, 35, 35, 35, 65, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65
];
XQueryTokenizer.MAP2 =
[ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 35, 31, 35, 31, 31, 35
];
XQueryTokenizer.INITIAL =
[ 1, 2, 36867, 45060, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
];
XQueryTokenizer.TRANSITION =
[ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22908, 18836, 17152, 19008, 19233, 20367, 19008, 17173, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 17365, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 17470, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 18157, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223, 36531, 17477, 19152, 17860, 17892, 17675, 17753, 17832, 17590, 21620, 17481, 17848, 17880, 18731, 17918, 36551, 17292, 17934, 17979, 18727, 18023, 36545, 18621, 18039, 18056, 18072, 18117, 18143, 18173, 18052, 18209, 18250, 18239, 18266, 17963, 18296, 18312, 18376, 17807, 36403, 19232, 17796, 17163, 30642, 18392, 17816, 32961, 17687, 18805, 18421, 18437, 18101, 17393, 18489, 18505, 18535, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18579, 21711, 17152, 19008, 19233, 20367, 19008, 28684, 30763, 36437, 17330, 17349, 18921, 17189, 17208, 17281, 20355, 17949, 17308, 17327, 17346, 18918, 17365, 21880, 18649, 18665, 19006, 17265, 22033, 20765, 17421, 20535, 17192, 18127, 21873, 17311, 18658, 18999, 19008, 17447, 17470, 17497, 17520, 17251, 36411, 17782, 20682, 17714, 18326, 17543, 17559, 17585, 21887, 17504, 17527, 17258, 36418, 18157, 21940, 17611, 36467, 18217, 17633, 17661, 21190, 17703, 21176, 17730, 34737, 21946, 17617, 36473, 18223
];
XQueryTokenizer.EXPECTED =
[ 290, 300, 304, 353, 296, 309, 305, 319, 315, 324, 328, 352, 354, 334, 338, 330, 320, 345, 349, 293, 358, 362, 341, 366, 312, 370, 374, 378, 382, 386, 390, 394, 398, 737, 402, 634, 439, 604, 634, 634, 634, 634, 408, 634, 634, 634, 404, 634, 634, 634, 457, 634, 634, 963, 634, 634, 413, 634, 634, 634, 634, 634, 634, 634, 663, 418, 422, 903, 902, 426, 431, 548, 634, 437, 521, 919, 443, 615, 409, 449, 455, 624, 731, 751, 634, 461, 465, 672, 470, 469, 474, 481, 485, 477, 489, 493, 629, 542, 497, 505, 603, 602, 991, 648, 510, 804, 634, 515, 958, 526, 525, 530, 768, 634, 546, 552, 711, 710, 593, 558, 562, 618, 566, 570, 574, 578, 582, 586, 590, 608, 612, 660, 822, 821, 634, 622, 596, 444, 628, 533, 724, 633, 640, 653, 647, 652, 536, 1008, 451, 450, 445, 657, 670, 676, 685, 689, 693, 697, 701, 704, 707, 715, 719, 798, 815, 634, 723, 762, 996, 634, 728, 969, 730, 735, 908, 634, 741, 679, 889, 511, 747, 634, 750, 755, 499, 666, 499, 501, 759, 772, 776, 780, 634, 787, 784, 797, 802, 809, 808, 427, 814, 1006, 517, 634, 519, 853, 634, 813, 850, 793, 634, 819, 826, 833, 832, 837, 843, 847, 857, 861, 863, 867, 871, 875, 879, 883, 643, 887, 539, 980, 979, 634, 893, 944, 634, 900, 896, 634, 907, 933, 506, 912, 917, 828, 433, 636, 635, 554, 961, 923, 930, 927, 937, 941, 634, 634, 634, 974, 948, 952, 985, 913, 968, 967, 743, 634, 973, 839, 634, 978, 599, 634, 984, 989, 765, 444, 995, 1000, 634, 1003, 790, 955, 1012, 681, 634, 634, 634, 634, 634, 414, 1016, 1020, 1024, 1085, 1027, 1090, 1090, 1046, 1080, 1137, 1108, 1215, 1049, 1032, 1039, 1085, 1085, 1085, 1085, 1058, 1062, 1068, 1085, 1086, 1090, 1090, 1091, 1072, 1064, 1107, 1090, 1090, 1090, 1118, 1123, 1138, 1078, 1074, 1084, 1085, 1085, 1085, 1087, 1090, 1062, 1052, 1060, 1114, 1062, 1104, 1085, 1085, 1090, 1090, 1028, 1122, 1063, 1128, 1139, 1127, 1158, 1085, 1085, 1151, 1090, 1090, 1090, 1095, 1090, 1132, 1073, 1136, 1143, 1061, 1150, 1085, 1155, 1098, 1101, 1146, 1162, 1169, 1101, 1185, 1151, 1090, 1110, 1173, 1054, 1087, 1109, 1177, 1165, 1089, 1204, 1184, 1107, 1189, 1193, 1088, 1197, 1180, 1201, 1208, 1042, 1212, 1219, 1223, 1227, 1231, 1235, 1245, 1777, 1527, 1686, 1686, 1238, 1686, 1254, 1686, 1686, 1686, 1294, 1669, 1686, 1686, 1686, 1322, 1625, 1534, 1268, 1624, 1275, 1281, 1443, 1292, 1300, 1686, 1686, 1686, 1350, 1826, 1306, 1686, 1686, 1240, 2032, 1317, 1321, 1686, 1686, 1253, 1686, 1326, 1686, 1686, 1686, 1418, 1709, 1446, 1686, 1686, 1686, 1492, 1686, 1295, 1447, 1686, 1686, 1258, 1686, 1736, 1686, 1686, 1520, 1355, 1686, 1288, 1348, 1361, 1686, 1359, 1686, 1364, 1498, 1368, 1302, 1362, 1381, 1389, 1395, 1486, 1686, 1371, 1377, 1370, 1686, 1375, 1382, 1384, 1402, 1408, 1385, 1383, 1619, 1413, 1423, 1428, 1433, 1686, 1686, 1270, 1686, 1338, 1686, 1440, 1686, 1686, 1686, 1499, 1465, 1686, 1686, 1686, 1639, 1473, 1884, 1686, 1686, 1293, 1864, 1686, 1686, 1296, 1321, 1483, 1686, 1686, 1686, 1646, 1686, 1748, 1496, 1686, 1418, 1675, 1686, 1418, 1702, 1686, 1418, 1981, 1686, 1429, 1409, 1427, 1504, 1692, 1686, 1686, 1313, 1448, 1651, 1508, 1686, 1686, 1340, 1686, 1903, 1686, 1686, 1435, 1513, 1686, 1283, 1287, 1519, 1686, 1524, 1363, 1568, 1938, 1539, 1566, 1579, 1479, 1533, 1538, 1553, 1544, 1552, 1557, 1563, 1574, 1557, 1583, 1589, 1590, 1759, 1594, 1603, 1607, 1611, 1686, 1436, 1514, 1686, 1434, 1656, 1686, 1434, 1680, 1686, 1453, 1686, 1686, 1686, 1559, 1617, 1686, 1770, 1418, 1623, 1769, 1629, 1686, 1515, 1335, 1686, 1285, 1686, 1671, 1921, 1650, 1686, 1686, 1344, 1308, 1666, 1686, 1686, 1686, 1659, 1685, 1686, 1686, 1686, 1686, 1241, 1686, 1686, 1844, 1691, 1686, 1630, 1977, 1970, 1362, 1686, 1686, 1686, 1693, 1698, 1686, 1686, 1686, 1697, 1686, 1764, 1715, 1686, 1634, 1638, 1686, 1599, 1585, 1686, 1271, 1686, 1269, 1686, 1721, 1686, 1686, 1354, 1686, 1801, 1686, 1799, 1686, 1640, 1686, 1686, 1461, 1686, 1686, 1732, 1686, 1944, 1686, 1740, 1686, 1746, 1415, 1396, 1686, 1598, 1547, 1417, 1597, 1416, 1577, 1546, 1397, 1577, 1547, 1548, 1570, 1398, 1753, 1686, 1652, 1509, 1686, 1686, 1686, 1757, 1686, 1419, 1686, 1763, 1418, 1768, 1781, 1686, 1686, 1686, 1705, 1686, 2048
];
XQueryTokenizer.TOKEN =
[
"(0)",
"ModuleDecl",
"Annotation",
"OptionDecl",
"Operator",
"Variable",
"Tag",
"EndTag",
"PragmaContents",
"DirCommentContents",
"DirPIContents",
"CDataSectionContents",
"AttrTest",
"Wildcard",
"EQName",
"IntegerLiteral",
"DecimalLiteral",
"DoubleLiteral",
"PredefinedEntityRef",
"'\"\"'",
"EscapeApos",
"QuotChar",
"AposChar",
"ElementContentChar",
"QuotAttrContentChar",
"AposAttrContentChar",
"NCName",
"QName",
"S",
"CharRef",
"CommentContents",
"DocTag",
"DocCommentContents",
"EOF",
"'!'",
"'\"'",
"'#'",
"'#)'",
"''''",
"'('",
"'(#'",
"'(:'",
"'(:~'",
"')'",
"'*'",
"'*'",
"','",
"'-->'",
"'.'",
"'/'",
"'/>'",
"':'",
"':)'",
"';'",
"'<!--'",
"'<![CDATA['",
"'<?'",
"'='",
"'>'",
"'?'",
"'?>'",
"'NaN'",
"'['",
"']'",
"']]>'",
"'after'",
"'all'",
"'allowing'",
"'ancestor'",
"'ancestor-or-self'",
"'and'",
"'any'",
"'append'",
"'array'",
"'as'",
"'ascending'",
"'at'",
"'attribute'",
"'base-uri'",
"'before'",
"'boundary-space'",
"'break'",
"'by'",
"'case'",
"'cast'",
"'castable'",
"'catch'",
"'check'",
"'child'",
"'collation'",
"'collection'",
"'comment'",
"'constraint'",
"'construction'",
"'contains'",
"'content'",
"'context'",
"'continue'",
"'copy'",
"'copy-namespaces'",
"'count'",
"'decimal-format'",
"'decimal-separator'",
"'declare'",
"'default'",
"'delete'",
"'descendant'",
"'descendant-or-self'",
"'descending'",
"'diacritics'",
"'different'",
"'digit'",
"'distance'",
"'div'",
"'document'",
"'document-node'",
"'element'",
"'else'",
"'empty'",
"'empty-sequence'",
"'encoding'",
"'end'",
"'entire'",
"'eq'",
"'every'",
"'exactly'",
"'except'",
"'exit'",
"'external'",
"'first'",
"'following'",
"'following-sibling'",
"'for'",
"'foreach'",
"'foreign'",
"'from'",
"'ft-option'",
"'ftand'",
"'ftnot'",
"'ftor'",
"'function'",
"'ge'",
"'greatest'",
"'group'",
"'grouping-separator'",
"'gt'",
"'idiv'",
"'if'",
"'import'",
"'in'",
"'index'",
"'infinity'",
"'inherit'",
"'insensitive'",
"'insert'",
"'instance'",
"'integrity'",
"'intersect'",
"'into'",
"'is'",
"'item'",
"'json'",
"'json-item'",
"'key'",
"'language'",
"'last'",
"'lax'",
"'le'",
"'least'",
"'let'",
"'levels'",
"'loop'",
"'lowercase'",
"'lt'",
"'minus-sign'",
"'mod'",
"'modify'",
"'module'",
"'most'",
"'namespace'",
"'namespace-node'",
"'ne'",
"'next'",
"'no'",
"'no-inherit'",
"'no-preserve'",
"'node'",
"'nodes'",
"'not'",
"'object'",
"'occurs'",
"'of'",
"'on'",
"'only'",
"'option'",
"'or'",
"'order'",
"'ordered'",
"'ordering'",
"'paragraph'",
"'paragraphs'",
"'parent'",
"'pattern-separator'",
"'per-mille'",
"'percent'",
"'phrase'",
"'position'",
"'preceding'",
"'preceding-sibling'",
"'preserve'",
"'previous'",
"'processing-instruction'",
"'relationship'",
"'rename'",
"'replace'",
"'return'",
"'returning'",
"'revalidation'",
"'same'",
"'satisfies'",
"'schema'",
"'schema-attribute'",
"'schema-element'",
"'score'",
"'self'",
"'sensitive'",
"'sentence'",
"'sentences'",
"'skip'",
"'sliding'",
"'some'",
"'stable'",
"'start'",
"'stemming'",
"'stop'",
"'strict'",
"'strip'",
"'structured-item'",
"'switch'",
"'text'",
"'then'",
"'thesaurus'",
"'times'",
"'to'",
"'treat'",
"'try'",
"'tumbling'",
"'type'",
"'typeswitch'",
"'union'",
"'unique'",
"'unordered'",
"'updating'",
"'uppercase'",
"'using'",
"'validate'",
"'value'",
"'variable'",
"'version'",
"'weight'",
"'when'",
"'where'",
"'while'",
"'wildcards'",
"'window'",
"'with'",
"'without'",
"'word'",
"'words'",
"'xquery'",
"'zero-digit'",
"'{'",
"'{{'",
"'|'",
"'}'",
"'}}'"
];
},{}],"/node_modules/xqlint/lib/lexers/lexer.js":[function(_dereq_,module,exports){
'use strict';
var TokenHandler = function(code) {
var input = code;
this.tokens = [];
this.reset = function() {
input = input;
this.tokens = [];
};
this.startNonterminal = function() {};
this.endNonterminal = function() {};
this.terminal = function(name, begin, end) {
this.tokens.push({
name: name,
value: input.substring(begin, end)
});
};
this.whitespace = function(begin, end) {
this.tokens.push({
name: 'WS',
value: input.substring(begin, end)
});
};
};
exports.Lexer = function(Tokenizer, Rules) {
this.tokens = [];
this.getLineTokens = function(line, state) {
state = (state === 'start' || !state) ? '["start"]' : state;
var stack = JSON.parse(state);
var h = new TokenHandler(line);
var tokenizer = new Tokenizer(line, h);
var tokens = [];
while(true) {
var currentState = stack[stack.length - 1];
try {
h.tokens = [];
tokenizer['parse_' + currentState]();
var info = null;
if(h.tokens.length > 1 && h.tokens[0].name === 'WS') {
tokens.push({
type: 'text',
value: h.tokens[0].value
});
h.tokens.splice(0, 1);
}
var token = h.tokens[0];
var rules = Rules[currentState];
for(var k = 0; k < rules.length; k++) {
var rule = Rules[currentState][k];
if((typeof(rule.name) === 'function' && rule.name(token)) || rule.name === token.name) {
info = rule;
break;
}
}
if(token.name === 'EOF') { break; }
if(token.value === '') { throw 'Encountered empty string lexical rule.'; }
tokens.push({
type: info === null ? 'text' : (typeof(info.token) === 'function' ? info.token(token.value) : info.token),
value: token.value
});
if(info && info.next) {
info.next(stack);
}
} catch(e) {
if(e instanceof tokenizer.ParseException) {
var index = 0;
for(var i=0; i < tokens.length; i++) {
index += tokens[i].value.length;
}
tokens.push({ type: 'text', value: line.substring(index) });
return {
tokens: tokens,
state: JSON.stringify(['start'])
};
} else {
throw e;
}
}
}
return {
tokens: tokens,
state: JSON.stringify(stack)
};
};
};
},{}],"/node_modules/xqlint/lib/lexers/xquery_lexer.js":[function(_dereq_,module,exports){
'use strict';
var XQueryTokenizer = _dereq_('./XQueryTokenizer').XQueryTokenizer;
var Lexer = _dereq_('./lexer').Lexer;
var keys = 'after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position|strict'.split('|');
var keywords = keys.map(function(val) { return { name: '\'' + val + '\'', token: 'keyword' }; });
var ncnames = keys.map(function(val) { return { name: '\'' + val + '\'', token: 'text', next: function(stack){ stack.pop(); } }; });
var cdata = 'constant.language';
var number = 'constant';
var xmlcomment = 'comment';
var pi = 'xml-pe';
var pragma = 'constant.buildin';
var n = function(name){
return '\'' + name + '\'';
};
var Rules = {
start: [
{ name: n('(#'), token: pragma, next: function(stack){ stack.push('Pragma'); } },
{ name: n('(:'), token: 'comment', next: function(stack){ stack.push('Comment'); } },
{ name: n('(:~'), token: 'comment.doc', next: function(stack){ stack.push('CommentDoc'); } },
{ name: n('<!--'), token: xmlcomment, next: function(stack){ stack.push('XMLComment'); } },
{ name: n('<?'), token: pi, next: function(stack) { stack.push('PI'); } },
{ name: n('\'\''), token: 'string', next: function(stack){ stack.push('AposString'); } },
{ name: n('"'), token: 'string', next: function(stack){ stack.push('QuotString'); } },
{ name: 'Annotation', token: 'support.function' },
{ name: 'ModuleDecl', token: 'keyword', next: function(stack){ stack.push('Prefix'); } },
{ name: 'OptionDecl', token: 'keyword', next: function(stack){ stack.push('_EQName'); } },
{ name: 'AttrTest', token: 'support.type' },
{ name: 'Variable', token: 'variable' },
{ name: n('<![CDATA['), token: cdata, next: function(stack){ stack.push('CData'); } },
{ name: 'IntegerLiteral', token: number },
{ name: 'DecimalLiteral', token: number },
{ name: 'DoubleLiteral', token: number },
{ name: 'Operator', token: 'keyword.operator' },
{ name: 'EQName', token: function(val) { return keys.indexOf(val) !== -1 ? 'keyword' : 'support.function'; } },
{ name: n('('), token: 'lparen' },
{ name: n(')'), token: 'rparen' },
{ name: 'Tag', token: 'meta.tag', next: function(stack){ stack.push('StartTag'); } },
{ name: n('}'), token: 'text', next: function(stack){ if(stack.length > 1) { stack.pop(); } } },
{ name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } } //, next: function(stack){ if(stack.length > 1) { stack.pop(); } } }
].concat(keywords),
_EQName: [
{ name: 'EQName', token: 'text', next: function(stack) { stack.pop(); } }
].concat(ncnames),
Prefix: [
{ name: 'NCName', token: 'text', next: function(stack) { stack.pop(); } }
].concat(ncnames),
StartTag: [
{ name: n('>'), token: 'meta.tag', next: function(stack){ stack.push('TagContent'); } },
{ name: 'QName', token: 'entity.other.attribute-name' },
{ name: n('='), token: 'text' },
{ name: n('\'\''), token: 'string', next: function(stack){ stack.push('AposAttr'); } },
{ name: n('"'), token: 'string', next: function(stack){ stack.push('QuotAttr'); } },
{ name: n('/>'), token: 'meta.tag.r', next: function(stack){ stack.pop(); } }
],
TagContent: [
{ name: 'ElementContentChar', token: 'text' },
{ name: n('<![CDATA['), token: cdata, next: function(stack){ stack.push('CData'); } },
{ name: n('<!--'), token: xmlcomment, next: function(stack){ stack.push('XMLComment'); } },
{ name: 'Tag', token: 'meta.tag', next: function(stack){ stack.push('StartTag'); } },
{ name: 'PredefinedEntityRef', token: 'constant.language.escape' },
{ name: 'CharRef', token: 'constant.language.escape' },
{ name: n('{{'), token: 'text' },
{ name: n('}}'), token: 'text' },
{ name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } },
{ name: 'EndTag', token: 'meta.tag', next: function(stack){ stack.pop(); stack.pop(); } }
],
AposAttr: [
{ name: n('\'\''), token: 'string', next: function(stack){ stack.pop(); } },
{ name: 'EscapeApos', token: 'constant.language.escape' },
{ name: 'AposAttrContentChar', token: 'string' },
{ name: 'PredefinedEntityRef', token: 'constant.language.escape' },
{ name: 'CharRef', token: 'constant.language.escape' },
{ name: n('{{'), token: 'string' },
{ name: n('}}'), token: 'string' },
{ name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } }
],
QuotAttr: [
{ name: n('\"'), token: 'string', next: function(stack){ stack.pop(); } },
{ name: 'EscapeQuot', token: 'constant.language.escape' },
{ name: 'QuotAttrContentChar', token: 'string' },
{ name: 'PredefinedEntityRef', token: 'constant.language.escape' },
{ name: 'CharRef', token: 'constant.language.escape' },
{ name: n('{{'), token: 'string' },
{ name: n('}}'), token: 'string' },
{ name: n('{'), token: 'text', next: function(stack){ stack.push('start'); } }
],
Pragma: [
{ name: 'PragmaContents', token: pragma },
{ name: n('#'), token: pragma },
{ name: n('#)'), token: pragma, next: function(stack){ stack.pop(); } }
],
Comment: [
{ name: 'CommentContents', token: 'comment' },
{ name: n('(:'), token: 'comment', next: function(stack){ stack.push('Comment'); } },
{ name: n(':)'), token: 'comment', next: function(stack){ stack.pop(); } }
],
CommentDoc: [
{ name: 'DocCommentContents', token: 'comment.doc' },
{ name: 'DocTag', token: 'comment.doc.tag' },
{ name: n('(:'), token: 'comment.doc', next: function(stack){ stack.push('CommentDoc'); } },
{ name: n(':)'), token: 'comment.doc', next: function(stack){ stack.pop(); } }
],
XMLComment: [
{ name: 'DirCommentContents', token: xmlcomment },
{ name: n('-->'), token: xmlcomment, next: function(stack){ stack.pop(); } }
],
CData: [
{ name: 'CDataSectionContents', token: cdata },
{ name: n(']]>'), token: cdata, next: function(stack){ stack.pop(); } }
],
PI: [
{ name: 'DirPIContents', token: pi },
{ name: n('?'), token: pi },
{ name: n('?>'), token: pi, next: function(stack){ stack.pop(); } }
],
AposString: [
{ name: n('\'\''), token: 'string', next: function(stack){ stack.pop(); } },
{ name: 'PredefinedEntityRef', token: 'constant.language.escape' },
{ name: 'CharRef', token: 'constant.language.escape' },
{ name: 'EscapeApos', token: 'constant.language.escape' },
{ name: 'AposChar', token: 'string' }
],
QuotString: [
{ name: n('"'), token: 'string', next: function(stack){ stack.pop(); } },
{ name: 'PredefinedEntityRef', token: 'constant.language.escape' },
{ name: 'CharRef', token: 'constant.language.escape' },
{ name: 'EscapeQuot', token: 'constant.language.escape' },
{ name: 'QuotChar', token: 'string' }
]
};
exports.XQueryLexer = function(){ return new Lexer(XQueryTokenizer, Rules); };
},{"./XQueryTokenizer":"/node_modules/xqlint/lib/lexers/XQueryTokenizer.js","./lexer":"/node_modules/xqlint/lib/lexers/lexer.js"}]},{},["/node_modules/xqlint/lib/lexers/xquery_lexer.js"]);
});
define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require("../behaviour").Behaviour;
var TokenIterator = require("../../token_iterator").TokenIterator;
var lang = require("../../lib/lang");
function is(token, type) {
return token && token.type.lastIndexOf(type + ".xml") > -1;
}
var XmlBehaviour = function () {
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
if (text == '"' || text == "'") {
var quote = text;
var selected = session.doc.getTextRange(editor.getSelectionRange());
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
return {
text: quote + selected + quote,
selection: false
};
}
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
var iterator = new TokenIterator(session, cursor.row, cursor.column);
var token = iterator.getCurrentToken();
if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
return {
text: "",
selection: [1, 1]
};
}
if (!token)
token = iterator.stepBackward();
if (!token)
return;
while (is(token, "tag-whitespace") || is(token, "whitespace")) {
token = iterator.stepBackward();
}
var rightSpace = !rightChar || rightChar.match(/\s/);
if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
return {
text: quote + quote,
selection: [1, 1]
};
}
}
});
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == selected) {
range.end.column++;
return range;
}
}
});
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
if (text == '>') {
var position = editor.getSelectionRange().start;
var iterator = new TokenIterator(session, position.row, position.column);
var token = iterator.getCurrentToken() || iterator.stepBackward();
if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
return;
if (is(token, "reference.attribute-value"))
return;
if (is(token, "attribute-value")) {
var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
if (position.column < tokenEndColumn)
return;
if (position.column == tokenEndColumn) {
var nextToken = iterator.stepForward();
if (nextToken && is(nextToken, "attribute-value"))
return;
iterator.stepBackward();
}
}
if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
return;
while (!is(token, "tag-name")) {
token = iterator.stepBackward();
if (token.value == "<") {
token = iterator.stepForward();
break;
}
}
var tokenRow = iterator.getCurrentTokenRow();
var tokenColumn = iterator.getCurrentTokenColumn();
if (is(iterator.stepBackward(), "end-tag-open"))
return;
var element = token.value;
if (tokenRow == position.row)
element = element.substring(0, position.column - tokenColumn);
if (this.voidElements.hasOwnProperty(element.toLowerCase()))
return;
return {
text: ">" + "</" + element + ">",
selection: [1, 1]
};
}
});
this.add("autoindent", "insertion", function (state, action, editor, session, text) {
if (text == "\n") {
var cursor = editor.getCursorPosition();
var line = session.getLine(cursor.row);
var iterator = new TokenIterator(session, cursor.row, cursor.column);
var token = iterator.getCurrentToken();
if (token && token.type.indexOf("tag-close") !== -1) {
if (token.value == "/>")
return;
while (token && token.type.indexOf("tag-name") === -1) {
token = iterator.stepBackward();
}
if (!token) {
return;
}
var tag = token.value;
var row = iterator.getCurrentTokenRow();
token = iterator.stepBackward();
if (!token || token.type.indexOf("end-tag") !== -1) {
return;
}
if (this.voidElements && !this.voidElements[tag]) {
var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
var line = session.getLine(row);
var nextIndent = this.$getIndent(line);
var indent = nextIndent + session.getTabString();
if (nextToken && nextToken.value === "</") {
return {
text: "\n" + indent + "\n" + nextIndent,
selection: [1, indent.length, 1, indent.length]
};
} else {
return {
text: "\n" + indent
};
}
}
}
}
});
};
oop.inherits(XmlBehaviour, Behaviour);
exports.XmlBehaviour = XmlBehaviour;
});
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(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require('../behaviour').Behaviour;
var CstyleBehaviour = require('./cstyle').CstyleBehaviour;
var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
var TokenIterator = require("../../token_iterator").TokenIterator;
function hasType(token, type) {
var hasType = true;
var typeList = token.type.split('.');
var needleList = type.split('.');
needleList.forEach(function(needle){
if (typeList.indexOf(needle) == -1) {
hasType = false;
return false;
}
});
return hasType;
}
var XQueryBehaviour = function () {
this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
this.inherit(XmlBehaviour); // Get xml behaviour
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
if (text == '>') {
var position = editor.getCursorPosition();
var iterator = new TokenIterator(session, position.row, position.column);
var token = iterator.getCurrentToken();
var atCursor = false;
var state = JSON.parse(state).pop();
if ((token && token.value === '>') || state !== "StartTag") return;
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
do {
token = iterator.stepBackward();
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
} else {
atCursor = true;
}
var previous = iterator.stepBackward();
if (!token || !hasType(token, 'meta.tag') || (previous !== null && previous.value.match('/'))) {
return;
}
var tag = token.value.substring(1);
if (atCursor){
var tag = tag.substring(0, position.column - token.start);
}
return {
text: '>' + '</' + tag + '>',
selection: [1, 1]
};
}
});
};
oop.inherits(XQueryBehaviour, Behaviour);
exports.XQueryBehaviour = XQueryBehaviour;
});
define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Range = require("../../range").Range;
var BaseFoldMode = require("./fold_mode").FoldMode;
var FoldMode = exports.FoldMode = function(commentRegex) {
if (commentRegex) {
this.foldingStartMarker = new RegExp(
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
);
this.foldingStopMarker = new RegExp(
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
);
}
};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
this._getFoldWidgetBase = this.getFoldWidget;
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
if (this.singleLineBlockCommentRe.test(line)) {
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
return "";
}
var fw = this._getFoldWidgetBase(session, foldStyle, row);
if (!fw && this.startRegionRe.test(line))
return "start"; // lineCommentRegionStart
return fw;
};
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
var line = session.getLine(row);
if (this.startRegionRe.test(line))
return this.getCommentRegionBlock(session, line, row);
var match = line.match(this.foldingStartMarker);
if (match) {
var i = match.index;
if (match[1])
return this.openingBracketBlock(session, match[1], row, i);
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
if (range && !range.isMultiLine()) {
if (forceMultiline) {
range = this.getSectionRange(session, row);
} else if (foldStyle != "all")
range = null;
}
return range;
}
if (foldStyle === "markbegin")
return;
var match = line.match(this.foldingStopMarker);
if (match) {
var i = match.index + match[0].length;
if (match[1])
return this.closingBracketBlock(session, match[1], row, i);
return session.getCommentFoldRange(row, i, -1);
}
};
this.getSectionRange = function(session, row) {
var line = session.getLine(row);
var startIndent = line.search(/\S/);
var startRow = row;
var startColumn = line.length;
row = row + 1;
var endRow = row;
var maxRow = session.getLength();
while (++row < maxRow) {
line = session.getLine(row);
var indent = line.search(/\S/);
if (indent === -1)
continue;
if (startIndent > indent)
break;
var subRange = this.getFoldWidgetRange(session, "all", row);
if (subRange) {
if (subRange.start.row <= startRow) {
break;
} else if (subRange.isMultiLine()) {
row = subRange.end.row;
} else if (startIndent == indent) {
break;
}
}
endRow = row;
}
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
};
this.getCommentRegionBlock = function(session, line, row) {
var startColumn = line.search(/\s*$/);
var maxRow = session.getLength();
var startRow = row;
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
var depth = 1;
while (++row < maxRow) {
line = session.getLine(row);
var m = re.exec(line);
if (!m) continue;
if (m[1]) depth--;
else depth++;
if (!depth) break;
}
var endRow = row;
if (endRow > startRow) {
return new Range(startRow, startColumn, endRow, line.length);
}
};
}).call(FoldMode.prototype);
});
define("ace/mode/xquery",["require","exports","module","ace/worker/worker_client","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/xquery/xquery_lexer","ace/range","ace/mode/behaviour/xquery","ace/mode/folding/cstyle","ace/anchor"], function(require, exports, module) {
"use strict";
var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XQueryLexer = require("./xquery/xquery_lexer").XQueryLexer;
var Range = require("../range").Range;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Anchor = require("../anchor").Anchor;
var Mode = function() {
this.$tokenizer = new XQueryLexer();
this.$behaviour = new XQueryBehaviour();
this.foldingRules = new CStyleFoldMode();
this.$highlightRules = new TextHighlightRules();
};
oop.inherits(Mode, TextMode);
(function() {
this.completer = {
getCompletions: function(editor, session, pos, prefix, callback) {
if (!session.$worker)
return callback();
session.$worker.emit("complete", { data: { pos: pos, prefix: prefix } });
session.$worker.on("complete", function(e){
callback(null, e.data);
});
}
};
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
if (match)
indent += tab;
return indent;
};
this.checkOutdent = function(state, line, input) {
if (! /^\s+$/.test(line))
return false;
return (/^\s*[\}\)]/).test(input);
};
this.autoOutdent = function(state, doc, row) {
var line = doc.getLine(row);
var match = line.match(/^(\s*[\}\)])/);
if (!match) return 0;
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.$getIndent(doc.getLine(openBracePos.row));
doc.replace(new Range(row, 0, row, column-1), indent);
};
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var i, line;
var outdent = true;
var re = /^\s*\(:(.*):\)/;
for (i=startRow; i<= endRow; i++) {
if (!re.test(doc.getLine(i))) {
outdent = false;
break;
}
}
var range = new Range(0, 0, 0, 0);
for (i=startRow; i<= endRow; i++) {
line = doc.getLine(i);
range.start.row = i;
range.end.row = i;
range.end.column = line.length;
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
}
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker");
var that = this;
worker.attachToDocument(session.getDocument());
worker.on("ok", function(e) {
session.clearAnnotations();
});
worker.on("markers", function(e) {
session.clearAnnotations();
that.addMarkers(e.data, session);
});
worker.on("highlight", function(tokens) {
that.$tokenizer.tokens = tokens.data.tokens;
that.$tokenizer.lines = session.getDocument().getAllLines();
var rows = Object.keys(that.$tokenizer.tokens);
for(var i=0; i < rows.length; i++) {
var row = parseInt(rows[i]);
delete session.bgTokenizer.lines[row];
delete session.bgTokenizer.states[row];
session.bgTokenizer.fireUpdateEvent(row, row);
}
});
return worker;
};
this.removeMarkers = function(session) {
var markers = session.getMarkers(false);
for (var id in markers) {
if (markers[id].clazz.indexOf('language_highlight_') === 0) {
session.removeMarker(id);
}
}
for (var i = 0; i < session.markerAnchors.length; i++) {
session.markerAnchors[i].detach();
}
session.markerAnchors = [];
};
this.addMarkers = function(annos, mySession) {
var _self = this;
if (!mySession.markerAnchors) mySession.markerAnchors = [];
this.removeMarkers(mySession);
mySession.languageAnnos = [];
annos.forEach(function(anno) {
var anchor = new Anchor(mySession.getDocument(), anno.pos.sl, anno.pos.sc || 0);
mySession.markerAnchors.push(anchor);
var markerId;
var colDiff = anno.pos.ec - anno.pos.sc;
var rowDiff = anno.pos.el - anno.pos.sl;
var gutterAnno = {
guttertext: anno.message,
type: anno.level || "warning",
text: anno.message
};
function updateFloat(single) {
if (markerId)
mySession.removeMarker(markerId);
gutterAnno.row = anchor.row;
if (anno.pos.sc !== undefined && anno.pos.ec !== undefined) {
var range = new Range(anno.pos.sl, anno.pos.sc, anno.pos.el, anno.pos.ec);
markerId = mySession.addMarker(range, "language_highlight_" + (anno.type ? anno.type : "default"));
}
if (single) mySession.setAnnotations(mySession.languageAnnos);
}
updateFloat();
anchor.on("change", function() {
updateFloat(true);
});
if (anno.message) mySession.languageAnnos.push(gutterAnno);
});
mySession.setAnnotations(mySession.languageAnnos);
};
this.$id = "ace/mode/xquery";
this.snippetFileId = "ace/snippets/xquery";
}).call(Mode.prototype);
exports.Mode = Mode;
}); (function() {
window.require(["ace/mode/xquery"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();