UNPKG

jsoniq

Version:

JSONiq implementation for JavaScript

976 lines (939 loc) 2.49 MB
// This file was generated on Sat May 2, 2015 23:07 (UTC+01) by REx v5.33 which is Copyright (c) 1979-2015 by Gunther Rademacher <grd@gmx.net> // REx command line: XQueryParser.ebnf -ll 2 -backtrack -tree -typescript export interface ParsingEventHandler { reset(source: string): void; startNonterminal(name: string, begin: number): void; endNonterminal(name: string, end: number): void; terminal(name: string, begin: number, end: number): void; whitespace(begin: number, end: number): void; } export class ParseException { private begin: number; private end: number; private state: number; private offending: number; private expected: number; constructor(b: number, e: number, s: number, o: number, x: number) { this.begin = b; this.end = e; this.state = s; this.offending = o; this.expected = x; } getBegin() {return this.begin;} getEnd() {return this.end;} getState() {return this.state;} getExpected() {return this.expected;} getOffending() {return this.offending;} getMessage() { return this.offending < 0 ? "lexical analysis failed" : "syntax error"; } } interface Memoizer { [index: number]: number; } export class Parser { constructor(source: string, parsingEventHandler: ParsingEventHandler) { this.eventHandler = parsingEventHandler; this.input = source; this.size = source.length; this.reset(0, 0, 0); } getInput() { return this.input; } private reset(l: number, b: number, e: number) { this.b0 = b; this.e0 = b; this.l1 = l; this.b1 = b; this.e1 = e; this.l2 = 0; this.end = e; this.ex = -1; this.memo = {}; this.eventHandler.reset(this.input); } getOffendingToken(e: ParseException) { var o = e.getOffending(); return o >= 0 ? Parser.TOKEN[o] : null; } getExpectedTokenSet(e: ParseException) { var expected: string[]; if (e.getExpected() < 0) { expected = Parser.getTokenSet(- e.getState()); } else { expected = [Parser.TOKEN[e.getExpected()]]; } return expected; } getErrorMessage(e: ParseException) { var tokenSet = this.getExpectedTokenSet(e); var found = this.getOffendingToken(e); var prefix = this.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..." + this.input.substring(e.getBegin(), Math.min(this.input.length, e.getBegin() + 64)) + "..."; } parse_XQuery() { this.eventHandler.startNonterminal("XQuery", this.e0); this.lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | // StringLiteral | S^WS | EOF | '$' | '%' | '(' | '(#' | '(:' | '+' | '-' | '.' | // '..' | '/' | '//' | ';' | '<' | '<!--' | '<?' | '@' | '[' | 'after' | // 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' | 'append' | 'array' | // 'as' | 'ascending' | 'at' | 'attribute' | 'base-uri' | 'before' | // 'boundary-space' | 'break' | 'case' | 'cast' | 'castable' | 'catch' | 'child' | // 'collation' | 'comment' | 'constraint' | 'construction' | 'context' | // 'continue' | 'copy' | 'copy-namespaces' | 'count' | 'decimal-format' | // 'declare' | 'default' | 'delete' | 'descendant' | 'descendant-or-self' | // 'descending' | 'div' | 'document' | 'document-node' | 'element' | 'else' | // 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | 'every' | 'except' | // 'exit' | 'external' | 'first' | 'following' | 'following-sibling' | 'for' | // 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | // 'in' | 'index' | 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | // 'is' | 'item' | 'json' | 'json-item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | // 'lt' | 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | // 'node' | 'nodes' | 'object' | 'only' | 'option' | 'or' | 'order' | 'ordered' | // 'ordering' | 'parent' | 'preceding' | 'preceding-sibling' | // 'processing-instruction' | 'rename' | 'replace' | 'return' | 'returning' | // 'revalidation' | 'satisfies' | 'schema' | 'schema-attribute' | 'schema-element' | // 'score' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | 'strict' | // 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'try' | 'tumbling' | // 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | 'validate' | // 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | 'xquery' | '{' | // '{|' this.whitespace(); this.parse_Module(); this.shift(25); // EOF this.eventHandler.endNonterminal("XQuery", this.e0); } private parse_Module() { this.eventHandler.startNonterminal("Module", this.e0); switch (this.l1) { case 274: // 'xquery' this.lookahead2W(198); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | // ';' | '<' | '<<' | '<=' | '=' | '>' | '>=' | '>>' | '[' | 'and' | 'cast' | // 'castable' | 'contains' | 'div' | 'encoding' | 'eq' | 'except' | 'ge' | 'gt' | // 'idiv' | 'instance' | 'intersect' | 'is' | 'le' | 'lt' | 'mod' | 'ne' | 'or' | // 'to' | 'treat' | 'union' | 'version' | '|' | '||' break; default: this.lk = this.l1; } if (this.lk == 64274 // 'xquery' 'encoding' || this.lk == 134930) // 'xquery' 'version' { this.parse_VersionDecl(); } this.lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | // StringLiteral | S^WS | EOF | '$' | '%' | '(' | '(#' | '(:' | '+' | '-' | '.' | // '..' | '/' | '//' | ';' | '<' | '<!--' | '<?' | '@' | '[' | 'after' | // 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' | 'append' | 'array' | // 'as' | 'ascending' | 'at' | 'attribute' | 'base-uri' | 'before' | // 'boundary-space' | 'break' | 'case' | 'cast' | 'castable' | 'catch' | 'child' | // 'collation' | 'comment' | 'constraint' | 'construction' | 'context' | // 'continue' | 'copy' | 'copy-namespaces' | 'count' | 'decimal-format' | // 'declare' | 'default' | 'delete' | 'descendant' | 'descendant-or-self' | // 'descending' | 'div' | 'document' | 'document-node' | 'element' | 'else' | // 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | 'every' | 'except' | // 'exit' | 'external' | 'first' | 'following' | 'following-sibling' | 'for' | // 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | // 'in' | 'index' | 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | // 'is' | 'item' | 'json' | 'json-item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | // 'lt' | 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | // 'node' | 'nodes' | 'object' | 'only' | 'option' | 'or' | 'order' | 'ordered' | // 'ordering' | 'parent' | 'preceding' | 'preceding-sibling' | // 'processing-instruction' | 'rename' | 'replace' | 'return' | 'returning' | // 'revalidation' | 'satisfies' | 'schema' | 'schema-attribute' | 'schema-element' | // 'score' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | 'strict' | // 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'try' | 'tumbling' | // 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | 'validate' | // 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | 'xquery' | '{' | // '{|' switch (this.l1) { case 182: // 'module' this.lookahead2W(193); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | // ';' | '<' | '<<' | '<=' | '=' | '>' | '>=' | '>>' | '[' | 'and' | 'cast' | // 'castable' | 'contains' | 'div' | 'eq' | 'except' | 'ge' | 'gt' | 'idiv' | // 'instance' | 'intersect' | 'is' | 'le' | 'lt' | 'mod' | 'namespace' | 'ne' | // 'or' | 'to' | 'treat' | 'union' | '|' | '||' break; default: this.lk = this.l1; } switch (this.lk) { case 94390: // 'module' 'namespace' this.whitespace(); this.parse_LibraryModule(); break; default: this.whitespace(); this.parse_MainModule(); } this.eventHandler.endNonterminal("Module", this.e0); } private parse_VersionDecl() { this.eventHandler.startNonterminal("VersionDecl", this.e0); this.shift(274); // 'xquery' this.lookahead1W(116); // S^WS | '(:' | 'encoding' | 'version' switch (this.l1) { case 125: // 'encoding' this.shift(125); // 'encoding' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral break; default: this.shift(263); // 'version' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral this.lookahead1W(109); // S^WS | '(:' | ';' | 'encoding' if (this.l1 == 125) // 'encoding' { this.shift(125); // 'encoding' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral } } this.lookahead1W(28); // S^WS | '(:' | ';' this.whitespace(); this.parse_Separator(); this.eventHandler.endNonterminal("VersionDecl", this.e0); } private parse_LibraryModule() { this.eventHandler.startNonterminal("LibraryModule", this.e0); this.parse_ModuleDecl(); this.lookahead1W(138); // S^WS | EOF | '(:' | 'declare' | 'import' this.whitespace(); this.parse_Prolog(); this.eventHandler.endNonterminal("LibraryModule", this.e0); } private parse_ModuleDecl() { this.eventHandler.startNonterminal("ModuleDecl", this.e0); this.shift(182); // 'module' this.lookahead1W(61); // S^WS | '(:' | 'namespace' this.shift(184); // 'namespace' this.lookahead1W(248); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' | // 'ancestor-or-self' | 'and' | 'append' | 'as' | 'ascending' | 'at' | 'attribute' | // 'base-uri' | 'before' | 'boundary-space' | 'break' | 'case' | 'cast' | // 'castable' | 'catch' | 'child' | 'collation' | 'comment' | 'constraint' | // 'construction' | 'context' | 'continue' | 'copy' | 'copy-namespaces' | 'count' | // 'decimal-format' | 'declare' | 'default' | 'delete' | 'descendant' | // 'descendant-or-self' | 'descending' | 'div' | 'document' | 'document-node' | // 'element' | 'else' | 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | // 'every' | 'except' | 'exit' | 'external' | 'first' | 'following' | // 'following-sibling' | 'for' | 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | // 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' | 'instance' | 'integrity' | // 'intersect' | 'into' | 'is' | 'item' | 'json' | 'last' | 'lax' | 'le' | 'let' | // 'loop' | 'lt' | 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | // 'ne' | 'node' | 'nodes' | 'object' | 'only' | 'option' | 'or' | 'order' | // 'ordered' | 'ordering' | 'parent' | 'preceding' | 'preceding-sibling' | // 'processing-instruction' | 'rename' | 'replace' | 'return' | 'returning' | // 'revalidation' | 'satisfies' | 'schema' | 'schema-attribute' | 'schema-element' | // 'score' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | 'strict' | // 'switch' | 'text' | 'to' | 'treat' | 'try' | 'tumbling' | 'type' | 'typeswitch' | // 'union' | 'unordered' | 'updating' | 'validate' | 'value' | 'variable' | // 'version' | 'where' | 'while' | 'with' | 'xquery' this.whitespace(); this.parse_NCName(); this.lookahead1W(29); // S^WS | '(:' | '=' this.shift(60); // '=' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral this.lookahead1W(28); // S^WS | '(:' | ';' this.whitespace(); this.parse_Separator(); this.eventHandler.endNonterminal("ModuleDecl", this.e0); } private parse_Prolog() { this.eventHandler.startNonterminal("Prolog", this.e0); for (;;) { this.lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | // StringLiteral | S^WS | EOF | '$' | '%' | '(' | '(#' | '(:' | '+' | '-' | '.' | // '..' | '/' | '//' | ';' | '<' | '<!--' | '<?' | '@' | '[' | 'after' | // 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' | 'append' | 'array' | // 'as' | 'ascending' | 'at' | 'attribute' | 'base-uri' | 'before' | // 'boundary-space' | 'break' | 'case' | 'cast' | 'castable' | 'catch' | 'child' | // 'collation' | 'comment' | 'constraint' | 'construction' | 'context' | // 'continue' | 'copy' | 'copy-namespaces' | 'count' | 'decimal-format' | // 'declare' | 'default' | 'delete' | 'descendant' | 'descendant-or-self' | // 'descending' | 'div' | 'document' | 'document-node' | 'element' | 'else' | // 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | 'every' | 'except' | // 'exit' | 'external' | 'first' | 'following' | 'following-sibling' | 'for' | // 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | // 'in' | 'index' | 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | // 'is' | 'item' | 'json' | 'json-item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | // 'lt' | 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | // 'node' | 'nodes' | 'object' | 'only' | 'option' | 'or' | 'order' | 'ordered' | // 'ordering' | 'parent' | 'preceding' | 'preceding-sibling' | // 'processing-instruction' | 'rename' | 'replace' | 'return' | 'returning' | // 'revalidation' | 'satisfies' | 'schema' | 'schema-attribute' | 'schema-element' | // 'score' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | 'strict' | // 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'try' | 'tumbling' | // 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | 'validate' | // 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | 'xquery' | '{' | // '{|' switch (this.l1) { case 108: // 'declare' this.lookahead2W(213); // S^WS | EOF | '!' | '!=' | '#' | '%' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | // '//' | ';' | '<' | '<<' | '<=' | '=' | '>' | '>=' | '>>' | '[' | 'and' | // 'base-uri' | 'boundary-space' | 'cast' | 'castable' | 'collection' | // 'construction' | 'contains' | 'context' | 'copy-namespaces' | 'decimal-format' | // 'default' | 'div' | 'eq' | 'except' | 'ft-option' | 'function' | 'ge' | 'gt' | // 'idiv' | 'index' | 'instance' | 'integrity' | 'intersect' | 'is' | 'le' | 'lt' | // 'mod' | 'namespace' | 'ne' | 'option' | 'or' | 'ordering' | 'revalidation' | // 'to' | 'treat' | 'union' | 'updating' | 'variable' | '|' | '||' break; case 153: // 'import' this.lookahead2W(201); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | // ';' | '<' | '<<' | '<=' | '=' | '>' | '>=' | '>>' | '[' | 'and' | 'cast' | // 'castable' | 'contains' | 'div' | 'eq' | 'except' | 'ge' | 'gt' | 'idiv' | // 'instance' | 'intersect' | 'is' | 'le' | 'lt' | 'mod' | 'module' | 'ne' | 'or' | // 'schema' | 'to' | 'treat' | 'union' | '|' | '||' break; default: this.lk = this.l1; } if (this.lk != 42604 // 'declare' 'base-uri' && this.lk != 43628 // 'declare' 'boundary-space' && this.lk != 50284 // 'declare' 'construction' && this.lk != 53356 // 'declare' 'copy-namespaces' && this.lk != 54380 // 'declare' 'decimal-format' && this.lk != 55916 // 'declare' 'default' && this.lk != 72300 // 'declare' 'ft-option' && this.lk != 93337 // 'import' 'module' && this.lk != 94316 // 'declare' 'namespace' && this.lk != 104044 // 'declare' 'ordering' && this.lk != 113772 // 'declare' 'revalidation' && this.lk != 115353) // 'import' 'schema' { break; } switch (this.l1) { case 108: // 'declare' this.lookahead2W(178); // S^WS | '(:' | 'base-uri' | 'boundary-space' | 'construction' | // 'copy-namespaces' | 'decimal-format' | 'default' | 'ft-option' | 'namespace' | // 'ordering' | 'revalidation' break; default: this.lk = this.l1; } if (this.lk == 55916) // 'declare' 'default' { this.lk = this.memoized(0, this.e0); if (this.lk == 0) { var b0A = this.b0; var e0A = this.e0; var l1A = this.l1; var b1A = this.b1; var e1A = this.e1; var l2A = this.l2; var b2A = this.b2; var e2A = this.e2; try { this.try_DefaultNamespaceDecl(); this.lk = -1; } catch (p1A) { this.lk = -2; } this.b0 = b0A; this.e0 = e0A; this.l1 = l1A; if (this.l1 == 0) {this.end = e0A;} else { this.b1 = b1A; this.e1 = e1A; this.l2 = l2A; if (this.l2 == 0) {this.end = e1A;} else { this.b2 = b2A; this.e2 = e2A; this.end = e2A; }} this.memoize(0, this.e0, this.lk); } } switch (this.lk) { case -1: this.whitespace(); this.parse_DefaultNamespaceDecl(); break; case 94316: // 'declare' 'namespace' this.whitespace(); this.parse_NamespaceDecl(); break; case 153: // 'import' this.whitespace(); this.parse_Import(); break; case 72300: // 'declare' 'ft-option' this.whitespace(); this.parse_FTOptionDecl(); break; default: this.whitespace(); this.parse_Setter(); } this.lookahead1W(28); // S^WS | '(:' | ';' this.whitespace(); this.parse_Separator(); } for (;;) { this.lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | // StringLiteral | S^WS | EOF | '$' | '%' | '(' | '(#' | '(:' | '+' | '-' | '.' | // '..' | '/' | '//' | ';' | '<' | '<!--' | '<?' | '@' | '[' | 'after' | // 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' | 'append' | 'array' | // 'as' | 'ascending' | 'at' | 'attribute' | 'base-uri' | 'before' | // 'boundary-space' | 'break' | 'case' | 'cast' | 'castable' | 'catch' | 'child' | // 'collation' | 'comment' | 'constraint' | 'construction' | 'context' | // 'continue' | 'copy' | 'copy-namespaces' | 'count' | 'decimal-format' | // 'declare' | 'default' | 'delete' | 'descendant' | 'descendant-or-self' | // 'descending' | 'div' | 'document' | 'document-node' | 'element' | 'else' | // 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | 'every' | 'except' | // 'exit' | 'external' | 'first' | 'following' | 'following-sibling' | 'for' | // 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | // 'in' | 'index' | 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | // 'is' | 'item' | 'json' | 'json-item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | // 'lt' | 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | // 'node' | 'nodes' | 'object' | 'only' | 'option' | 'or' | 'order' | 'ordered' | // 'ordering' | 'parent' | 'preceding' | 'preceding-sibling' | // 'processing-instruction' | 'rename' | 'replace' | 'return' | 'returning' | // 'revalidation' | 'satisfies' | 'schema' | 'schema-attribute' | 'schema-element' | // 'score' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | 'strict' | // 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'try' | 'tumbling' | // 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | 'validate' | // 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | 'xquery' | '{' | // '{|' switch (this.l1) { case 108: // 'declare' this.lookahead2W(210); // S^WS | EOF | '!' | '!=' | '#' | '%' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | // '//' | ';' | '<' | '<<' | '<=' | '=' | '>' | '>=' | '>>' | '[' | 'and' | 'cast' | // 'castable' | 'collection' | 'contains' | 'context' | 'div' | 'eq' | 'except' | // 'function' | 'ge' | 'gt' | 'idiv' | 'index' | 'instance' | 'integrity' | // 'intersect' | 'is' | 'le' | 'lt' | 'mod' | 'ne' | 'option' | 'or' | 'to' | // 'treat' | 'union' | 'updating' | 'variable' | '|' | '||' break; default: this.lk = this.l1; } if (this.lk != 16492 // 'declare' '%' && this.lk != 48748 // 'declare' 'collection' && this.lk != 51820 // 'declare' 'context' && this.lk != 74348 // 'declare' 'function' && this.lk != 79468 // 'declare' 'index' && this.lk != 82540 // 'declare' 'integrity' && this.lk != 101996 // 'declare' 'option' && this.lk != 131692 // 'declare' 'updating' && this.lk != 134252) // 'declare' 'variable' { break; } switch (this.l1) { case 108: // 'declare' this.lookahead2W(175); // S^WS | '%' | '(:' | 'collection' | 'context' | 'function' | 'index' | // 'integrity' | 'option' | 'updating' | 'variable' break; default: this.lk = this.l1; } switch (this.lk) { case 51820: // 'declare' 'context' this.whitespace(); this.parse_ContextItemDecl(); break; case 101996: // 'declare' 'option' this.whitespace(); this.parse_OptionDecl(); break; default: this.whitespace(); this.parse_AnnotatedDecl(); } this.lookahead1W(28); // S^WS | '(:' | ';' this.whitespace(); this.parse_Separator(); } this.eventHandler.endNonterminal("Prolog", this.e0); } private parse_Separator() { this.eventHandler.startNonterminal("Separator", this.e0); this.shift(53); // ';' this.eventHandler.endNonterminal("Separator", this.e0); } private parse_Setter() { this.eventHandler.startNonterminal("Setter", this.e0); switch (this.l1) { case 108: // 'declare' this.lookahead2W(172); // S^WS | '(:' | 'base-uri' | 'boundary-space' | 'construction' | // 'copy-namespaces' | 'decimal-format' | 'default' | 'ordering' | 'revalidation' break; default: this.lk = this.l1; } if (this.lk == 55916) // 'declare' 'default' { this.lk = this.memoized(1, this.e0); if (this.lk == 0) { var b0A = this.b0; var e0A = this.e0; var l1A = this.l1; var b1A = this.b1; var e1A = this.e1; var l2A = this.l2; var b2A = this.b2; var e2A = this.e2; try { this.try_DefaultCollationDecl(); this.lk = -2; } catch (p2A) { try { this.b0 = b0A; this.e0 = e0A; this.l1 = l1A; if (this.l1 == 0) {this.end = e0A;} else { this.b1 = b1A; this.e1 = e1A; this.l2 = l2A; if (this.l2 == 0) {this.end = e1A;} else { this.b2 = b2A; this.e2 = e2A; this.end = e2A; }} this.try_EmptyOrderDecl(); this.lk = -6; } catch (p6A) { this.lk = -9; } } this.b0 = b0A; this.e0 = e0A; this.l1 = l1A; if (this.l1 == 0) {this.end = e0A;} else { this.b1 = b1A; this.e1 = e1A; this.l2 = l2A; if (this.l2 == 0) {this.end = e1A;} else { this.b2 = b2A; this.e2 = e2A; this.end = e2A; }} this.memoize(1, this.e0, this.lk); } } switch (this.lk) { case 43628: // 'declare' 'boundary-space' this.parse_BoundarySpaceDecl(); break; case -2: this.parse_DefaultCollationDecl(); break; case 42604: // 'declare' 'base-uri' this.parse_BaseURIDecl(); break; case 50284: // 'declare' 'construction' this.parse_ConstructionDecl(); break; case 104044: // 'declare' 'ordering' this.parse_OrderingModeDecl(); break; case -6: this.parse_EmptyOrderDecl(); break; case 113772: // 'declare' 'revalidation' this.parse_RevalidationDecl(); break; case 53356: // 'declare' 'copy-namespaces' this.parse_CopyNamespacesDecl(); break; default: this.parse_DecimalFormatDecl(); } this.eventHandler.endNonterminal("Setter", this.e0); } private parse_BoundarySpaceDecl() { this.eventHandler.startNonterminal("BoundarySpaceDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(33); // S^WS | '(:' | 'boundary-space' this.shift(85); // 'boundary-space' this.lookahead1W(133); // S^WS | '(:' | 'preserve' | 'strip' switch (this.l1) { case 214: // 'preserve' this.shift(214); // 'preserve' break; default: this.shift(241); // 'strip' } this.eventHandler.endNonterminal("BoundarySpaceDecl", this.e0); } private parse_DefaultCollationDecl() { this.eventHandler.startNonterminal("DefaultCollationDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(46); // S^WS | '(:' | 'default' this.shift(109); // 'default' this.lookahead1W(38); // S^WS | '(:' | 'collation' this.shift(94); // 'collation' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral this.eventHandler.endNonterminal("DefaultCollationDecl", this.e0); } private try_DefaultCollationDecl() { this.shiftT(108); // 'declare' this.lookahead1W(46); // S^WS | '(:' | 'default' this.shiftT(109); // 'default' this.lookahead1W(38); // S^WS | '(:' | 'collation' this.shiftT(94); // 'collation' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shiftT(7); // URILiteral } private parse_BaseURIDecl() { this.eventHandler.startNonterminal("BaseURIDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(32); // S^WS | '(:' | 'base-uri' this.shift(83); // 'base-uri' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral this.eventHandler.endNonterminal("BaseURIDecl", this.e0); } private parse_ConstructionDecl() { this.eventHandler.startNonterminal("ConstructionDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(41); // S^WS | '(:' | 'construction' this.shift(98); // 'construction' this.lookahead1W(133); // S^WS | '(:' | 'preserve' | 'strip' switch (this.l1) { case 241: // 'strip' this.shift(241); // 'strip' break; default: this.shift(214); // 'preserve' } this.eventHandler.endNonterminal("ConstructionDecl", this.e0); } private parse_OrderingModeDecl() { this.eventHandler.startNonterminal("OrderingModeDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(68); // S^WS | '(:' | 'ordering' this.shift(203); // 'ordering' this.lookahead1W(131); // S^WS | '(:' | 'ordered' | 'unordered' switch (this.l1) { case 202: // 'ordered' this.shift(202); // 'ordered' break; default: this.shift(256); // 'unordered' } this.eventHandler.endNonterminal("OrderingModeDecl", this.e0); } private parse_EmptyOrderDecl() { this.eventHandler.startNonterminal("EmptyOrderDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(46); // S^WS | '(:' | 'default' this.shift(109); // 'default' this.lookahead1W(67); // S^WS | '(:' | 'order' this.shift(201); // 'order' this.lookahead1W(49); // S^WS | '(:' | 'empty' this.shift(123); // 'empty' this.lookahead1W(121); // S^WS | '(:' | 'greatest' | 'least' switch (this.l1) { case 147: // 'greatest' this.shift(147); // 'greatest' break; default: this.shift(173); // 'least' } this.eventHandler.endNonterminal("EmptyOrderDecl", this.e0); } private try_EmptyOrderDecl() { this.shiftT(108); // 'declare' this.lookahead1W(46); // S^WS | '(:' | 'default' this.shiftT(109); // 'default' this.lookahead1W(67); // S^WS | '(:' | 'order' this.shiftT(201); // 'order' this.lookahead1W(49); // S^WS | '(:' | 'empty' this.shiftT(123); // 'empty' this.lookahead1W(121); // S^WS | '(:' | 'greatest' | 'least' switch (this.l1) { case 147: // 'greatest' this.shiftT(147); // 'greatest' break; default: this.shiftT(173); // 'least' } } private parse_CopyNamespacesDecl() { this.eventHandler.startNonterminal("CopyNamespacesDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(44); // S^WS | '(:' | 'copy-namespaces' this.shift(104); // 'copy-namespaces' this.lookahead1W(128); // S^WS | '(:' | 'no-preserve' | 'preserve' this.whitespace(); this.parse_PreserveMode(); this.lookahead1W(25); // S^WS | '(:' | ',' this.shift(41); // ',' this.lookahead1W(123); // S^WS | '(:' | 'inherit' | 'no-inherit' this.whitespace(); this.parse_InheritMode(); this.eventHandler.endNonterminal("CopyNamespacesDecl", this.e0); } private parse_PreserveMode() { this.eventHandler.startNonterminal("PreserveMode", this.e0); switch (this.l1) { case 214: // 'preserve' this.shift(214); // 'preserve' break; default: this.shift(190); // 'no-preserve' } this.eventHandler.endNonterminal("PreserveMode", this.e0); } private parse_InheritMode() { this.eventHandler.startNonterminal("InheritMode", this.e0); switch (this.l1) { case 157: // 'inherit' this.shift(157); // 'inherit' break; default: this.shift(189); // 'no-inherit' } this.eventHandler.endNonterminal("InheritMode", this.e0); } private parse_DecimalFormatDecl() { this.eventHandler.startNonterminal("DecimalFormatDecl", this.e0); this.shift(108); // 'declare' this.lookahead1W(114); // S^WS | '(:' | 'decimal-format' | 'default' switch (this.l1) { case 106: // 'decimal-format' this.shift(106); // 'decimal-format' this.lookahead1W(254); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' | // 'ancestor-or-self' | 'and' | 'append' | 'array' | 'as' | 'ascending' | 'at' | // 'attribute' | 'base-uri' | 'before' | 'boundary-space' | 'break' | 'case' | // 'cast' | 'castable' | 'catch' | 'child' | 'collation' | 'comment' | // 'constraint' | 'construction' | 'context' | 'continue' | 'copy' | // 'copy-namespaces' | 'count' | 'decimal-format' | 'declare' | 'default' | // 'delete' | 'descendant' | 'descendant-or-self' | 'descending' | 'div' | // 'document' | 'document-node' | 'element' | 'else' | 'empty' | 'empty-sequence' | // 'encoding' | 'end' | 'eq' | 'every' | 'except' | 'exit' | 'external' | 'first' | // 'following' | 'following-sibling' | 'for' | 'ft-option' | 'function' | 'ge' | // 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' | // 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | 'json' | // 'json-item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' | 'modify' | // 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' | 'object' | // 'only' | 'option' | 'or' | 'order' | 'ordered' | 'ordering' | 'parent' | // 'preceding' | 'preceding-sibling' | 'processing-instruction' | 'rename' | // 'replace' | 'return' | 'returning' | 'revalidation' | 'satisfies' | 'schema' | // 'schema-attribute' | 'schema-element' | 'score' | 'self' | 'sliding' | 'some' | // 'stable' | 'start' | 'strict' | 'structured-item' | 'switch' | 'text' | 'to' | // 'treat' | 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | // 'updating' | 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | // 'with' | 'xquery' this.whitespace(); this.parse_EQName(); break; default: this.shift(109); // 'default' this.lookahead1W(45); // S^WS | '(:' | 'decimal-format' this.shift(106); // 'decimal-format' } for (;;) { this.lookahead1W(180); // S^WS | '(:' | ';' | 'NaN' | 'decimal-separator' | 'digit' | // 'grouping-separator' | 'infinity' | 'minus-sign' | 'pattern-separator' | // 'per-mille' | 'percent' | 'zero-digit' if (this.l1 == 53) // ';' { break; } this.whitespace(); this.parse_DFPropertyName(); this.lookahead1W(29); // S^WS | '(:' | '=' this.shift(60); // '=' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral } this.eventHandler.endNonterminal("DecimalFormatDecl", this.e0); } private parse_DFPropertyName() { this.eventHandler.startNonterminal("DFPropertyName", this.e0); switch (this.l1) { case 107: // 'decimal-separator' this.shift(107); // 'decimal-separator' break; case 149: // 'grouping-separator' this.shift(149); // 'grouping-separator' break; case 156: // 'infinity' this.shift(156); // 'infinity' break; case 179: // 'minus-sign' this.shift(179); // 'minus-sign' break; case 67: // 'NaN' this.shift(67); // 'NaN' break; case 209: // 'percent' this.shift(209); // 'percent' break; case 208: // 'per-mille' this.shift(208); // 'per-mille' break; case 275: // 'zero-digit' this.shift(275); // 'zero-digit' break; case 116: // 'digit' this.shift(116); // 'digit' break; default: this.shift(207); // 'pattern-separator' } this.eventHandler.endNonterminal("DFPropertyName", this.e0); } private parse_Import() { this.eventHandler.startNonterminal("Import", this.e0); switch (this.l1) { case 153: // 'import' this.lookahead2W(126); // S^WS | '(:' | 'module' | 'schema' break; default: this.lk = this.l1; } switch (this.lk) { case 115353: // 'import' 'schema' this.parse_SchemaImport(); break; default: this.parse_ModuleImport(); } this.eventHandler.endNonterminal("Import", this.e0); } private parse_SchemaImport() { this.eventHandler.startNonterminal("SchemaImport", this.e0); this.shift(153); // 'import' this.lookahead1W(73); // S^WS | '(:' | 'schema' this.shift(225); // 'schema' this.lookahead1W(137); // URILiteral | S^WS | '(:' | 'default' | 'namespace' if (this.l1 != 7) // URILiteral { this.whitespace(); this.parse_SchemaPrefix(); } this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral this.lookahead1W(108); // S^WS | '(:' | ';' | 'at' if (this.l1 == 81) // 'at' { this.shift(81); // 'at' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral for (;;) { this.lookahead1W(103); // S^WS | '(:' | ',' | ';' if (this.l1 != 41) // ',' { break; } this.shift(41); // ',' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral } } this.eventHandler.endNonterminal("SchemaImport", this.e0); } private parse_SchemaPrefix() { this.eventHandler.startNonterminal("SchemaPrefix", this.e0); switch (this.l1) { case 184: // 'namespace' this.shift(184); // 'namespace' this.lookahead1W(248); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' | // 'ancestor-or-self' | 'and' | 'append' | 'as' | 'ascending' | 'at' | 'attribute' | // 'base-uri' | 'before' | 'boundary-space' | 'break' | 'case' | 'cast' | // 'castable' | 'catch' | 'child' | 'collation' | 'comment' | 'constraint' | // 'construction' | 'context' | 'continue' | 'copy' | 'copy-namespaces' | 'count' | // 'decimal-format' | 'declare' | 'default' | 'delete' | 'descendant' | // 'descendant-or-self' | 'descending' | 'div' | 'document' | 'document-node' | // 'element' | 'else' | 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | // 'every' | 'except' | 'exit' | 'external' | 'first' | 'following' | // 'following-sibling' | 'for' | 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | // 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' | 'instance' | 'integrity' | // 'intersect' | 'into' | 'is' | 'item' | 'json' | 'last' | 'lax' | 'le' | 'let' | // 'loop' | 'lt' | 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | // 'ne' | 'node' | 'nodes' | 'object' | 'only' | 'option' | 'or' | 'order' | // 'ordered' | 'ordering' | 'parent' | 'preceding' | 'preceding-sibling' | // 'processing-instruction' | 'rename' | 'replace' | 'return' | 'returning' | // 'revalidation' | 'satisfies' | 'schema' | 'schema-attribute' | 'schema-element' | // 'score' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | 'strict' | // 'switch' | 'text' | 'to' | 'treat' | 'try' | 'tumbling' | 'type' | 'typeswitch' | // 'union' | 'unordered' | 'updating' | 'validate' | 'value' | 'variable' | // 'version' | 'where' | 'while' | 'with' | 'xquery' this.whitespace(); this.parse_NCName(); this.lookahead1W(29); // S^WS | '(:' | '=' this.shift(60); // '=' break; default: this.shift(109); // 'default' this.lookahead1W(47); // S^WS | '(:' | 'element' this.shift(121); // 'element' this.lookahead1W(61); // S^WS | '(:' | 'namespace' this.shift(184); // 'namespace' } this.eventHandler.endNonterminal("SchemaPrefix", this.e0); } private parse_ModuleImport() { this.eventHandler.startNonterminal("ModuleImport", this.e0); this.shift(153); // 'import' this.lookahead1W(60); // S^WS | '(:' | 'module' this.shift(182); // 'module' this.lookahead1W(90); // URILiteral | S^WS | '(:' | 'namespace' if (this.l1 == 184) // 'namespace' { this.shift(184); // 'namespace' this.lookahead1W(248); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' | // 'ancestor-or-self' | 'and' | 'append' | 'as' | 'ascending' | 'at' | 'attribute' | // 'base-uri' | 'before' | 'boundary-space' | 'break' | 'case' | 'cast' | // 'castable' | 'catch' | 'child' | 'collation' | 'comment' | 'constraint' | // 'construction' | 'context' | 'continue' | 'copy' | 'copy-namespaces' | 'count' | // 'decimal-format' |