UNPKG

jsoniq

Version:

JSONiq implementation for JavaScript

979 lines (941 loc) 3.05 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: JSONiqParser.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(277); // 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' | 'false' | // 'first' | 'following' | 'following-sibling' | 'for' | 'from' | 'ft-option' | // 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | // 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | // 'json' | 'json-item' | 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | // 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | // 'nodes' | 'not' | 'null' | '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' | 'select' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | // 'strict' | 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'true' | // 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | // '{' | '{|' 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 170: // 'jsoniq' this.lookahead2W(168); // S^WS | '#' | '(' | '(:' | 'encoding' | 'version' break; default: this.lk = this.l1; } if (this.lk == 64682 // 'jsoniq' 'encoding' || this.lk == 137898) // 'jsoniq' 'version' { this.parse_VersionDecl(); } this.lookahead1W(277); // 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' | 'false' | // 'first' | 'following' | 'following-sibling' | 'for' | 'from' | 'ft-option' | // 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | // 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | // 'json' | 'json-item' | 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | // 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | // 'nodes' | 'not' | 'null' | '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' | 'select' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | // 'strict' | 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'true' | // 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | // '{' | '{|' switch (this.l1) { case 185: // 'module' this.lookahead2W(146); // S^WS | '#' | '(' | '(:' | 'namespace' break; default: this.lk = this.l1; } switch (this.lk) { case 95929: // '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(170); // 'jsoniq' this.lookahead1W(120); // S^WS | '(:' | 'encoding' | 'version' switch (this.l1) { case 126: // 'encoding' this.shift(126); // 'encoding' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral break; default: this.shift(269); // 'version' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral this.lookahead1W(113); // S^WS | '(:' | ';' | 'encoding' if (this.l1 == 126) // 'encoding' { this.shift(126); // 'encoding' this.lookahead1W(17); // StringLiteral | S^WS | '(:' this.shift(11); // StringLiteral } } this.lookahead1W(29); // 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(142); // 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(185); // 'module' this.lookahead1W(64); // S^WS | '(:' | 'namespace' this.shift(187); // 'namespace' this.lookahead1W(239); // 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' | 'false' | 'first' | 'following' | // 'following-sibling' | 'for' | 'from' | 'ft-option' | 'function' | 'ge' | // 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' | // 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | 'json' | // 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' | 'modify' | // 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' | 'null' | // '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' | 'select' | 'self' | // 'sliding' | 'some' | 'stable' | 'start' | 'strict' | 'switch' | 'text' | 'to' | // 'treat' | 'true' | 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | // 'unordered' | 'updating' | 'validate' | 'value' | 'variable' | 'version' | // 'where' | 'while' | 'with' this.whitespace(); this.parse_NCName(); this.lookahead1W(30); // S^WS | '(:' | '=' this.shift(61); // '=' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral this.lookahead1W(29); // 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(277); // 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' | 'false' | // 'first' | 'following' | 'following-sibling' | 'for' | 'from' | 'ft-option' | // 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | // 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | // 'json' | 'json-item' | 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | // 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | // 'nodes' | 'not' | 'null' | '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' | 'select' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | // 'strict' | 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'true' | // 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | // '{' | '{|' switch (this.l1) { case 109: // 'declare' this.lookahead2W(206); // S^WS | '#' | '%' | '(' | '(:' | 'base-uri' | 'boundary-space' | 'collection' | // 'construction' | 'context' | 'copy-namespaces' | 'decimal-format' | 'default' | // 'ft-option' | 'function' | 'index' | 'integrity' | 'namespace' | 'option' | // 'ordering' | 'revalidation' | 'updating' | 'variable' break; case 155: // 'import' this.lookahead2W(169); // S^WS | '#' | '(' | '(:' | 'module' | 'schema' break; default: this.lk = this.l1; } if (this.lk != 43117 // 'declare' 'base-uri' && this.lk != 44141 // 'declare' 'boundary-space' && this.lk != 50797 // 'declare' 'construction' && this.lk != 53869 // 'declare' 'copy-namespaces' && this.lk != 54893 // 'declare' 'decimal-format' && this.lk != 56429 // 'declare' 'default' && this.lk != 73325 // 'declare' 'ft-option' && this.lk != 94875 // 'import' 'module' && this.lk != 95853 // 'declare' 'namespace' && this.lk != 106093 // 'declare' 'ordering' && this.lk != 115821 // 'declare' 'revalidation' && this.lk != 117403) // 'import' 'schema' { break; } switch (this.l1) { case 109: // 'declare' this.lookahead2W(200); // 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 == 56429) // '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 95853: // 'declare' 'namespace' this.whitespace(); this.parse_NamespaceDecl(); break; case 155: // 'import' this.whitespace(); this.parse_Import(); break; case 73325: // 'declare' 'ft-option' this.whitespace(); this.parse_FTOptionDecl(); break; default: this.whitespace(); this.parse_Setter(); } this.lookahead1W(29); // S^WS | '(:' | ';' this.whitespace(); this.parse_Separator(); } for (;;) { this.lookahead1W(277); // 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' | 'false' | // 'first' | 'following' | 'following-sibling' | 'for' | 'from' | 'ft-option' | // 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | // 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | // 'json' | 'json-item' | 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | // 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | // 'nodes' | 'not' | 'null' | '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' | 'select' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | // 'strict' | 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'true' | // 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' | // '{' | '{|' switch (this.l1) { case 109: // 'declare' this.lookahead2W(201); // S^WS | '#' | '%' | '(' | '(:' | 'collection' | 'context' | 'function' | 'index' | // 'integrity' | 'option' | 'updating' | 'variable' break; default: this.lk = this.l1; } if (this.lk != 17005 // 'declare' '%' && this.lk != 49261 // 'declare' 'collection' && this.lk != 52333 // 'declare' 'context' && this.lk != 75373 // 'declare' 'function' && this.lk != 80493 // 'declare' 'index' && this.lk != 83565 // 'declare' 'integrity' && this.lk != 104045 // 'declare' 'option' && this.lk != 134765 // 'declare' 'updating' && this.lk != 137325) // 'declare' 'variable' { break; } switch (this.l1) { case 109: // 'declare' this.lookahead2W(197); // S^WS | '%' | '(:' | 'collection' | 'context' | 'function' | 'index' | // 'integrity' | 'option' | 'updating' | 'variable' break; default: this.lk = this.l1; } switch (this.lk) { case 52333: // 'declare' 'context' this.whitespace(); this.parse_ContextItemDecl(); break; case 104045: // 'declare' 'option' this.whitespace(); this.parse_OptionDecl(); break; default: this.whitespace(); this.parse_AnnotatedDecl(); } this.lookahead1W(29); // S^WS | '(:' | ';' this.whitespace(); this.parse_Separator(); } this.eventHandler.endNonterminal("Prolog", this.e0); } private parse_Separator() { this.eventHandler.startNonterminal("Separator", this.e0); this.shift(54); // ';' this.eventHandler.endNonterminal("Separator", this.e0); } private parse_Setter() { this.eventHandler.startNonterminal("Setter", this.e0); switch (this.l1) { case 109: // 'declare' this.lookahead2W(194); // S^WS | '(:' | 'base-uri' | 'boundary-space' | 'construction' | // 'copy-namespaces' | 'decimal-format' | 'default' | 'ordering' | 'revalidation' break; default: this.lk = this.l1; } if (this.lk == 56429) // '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 44141: // 'declare' 'boundary-space' this.parse_BoundarySpaceDecl(); break; case -2: this.parse_DefaultCollationDecl(); break; case 43117: // 'declare' 'base-uri' this.parse_BaseURIDecl(); break; case 50797: // 'declare' 'construction' this.parse_ConstructionDecl(); break; case 106093: // 'declare' 'ordering' this.parse_OrderingModeDecl(); break; case -6: this.parse_EmptyOrderDecl(); break; case 115821: // 'declare' 'revalidation' this.parse_RevalidationDecl(); break; case 53869: // '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(109); // 'declare' this.lookahead1W(36); // S^WS | '(:' | 'boundary-space' this.shift(86); // 'boundary-space' this.lookahead1W(137); // S^WS | '(:' | 'preserve' | 'strip' switch (this.l1) { case 218: // 'preserve' this.shift(218); // 'preserve' break; default: this.shift(246); // 'strip' } this.eventHandler.endNonterminal("BoundarySpaceDecl", this.e0); } private parse_DefaultCollationDecl() { this.eventHandler.startNonterminal("DefaultCollationDecl", this.e0); this.shift(109); // 'declare' this.lookahead1W(49); // S^WS | '(:' | 'default' this.shift(110); // 'default' this.lookahead1W(41); // S^WS | '(:' | 'collation' this.shift(95); // 'collation' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral this.eventHandler.endNonterminal("DefaultCollationDecl", this.e0); } private try_DefaultCollationDecl() { this.shiftT(109); // 'declare' this.lookahead1W(49); // S^WS | '(:' | 'default' this.shiftT(110); // 'default' this.lookahead1W(41); // S^WS | '(:' | 'collation' this.shiftT(95); // 'collation' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shiftT(7); // URILiteral } private parse_BaseURIDecl() { this.eventHandler.startNonterminal("BaseURIDecl", this.e0); this.shift(109); // 'declare' this.lookahead1W(35); // S^WS | '(:' | 'base-uri' this.shift(84); // '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(109); // 'declare' this.lookahead1W(44); // S^WS | '(:' | 'construction' this.shift(99); // 'construction' this.lookahead1W(137); // S^WS | '(:' | 'preserve' | 'strip' switch (this.l1) { case 246: // 'strip' this.shift(246); // 'strip' break; default: this.shift(218); // 'preserve' } this.eventHandler.endNonterminal("ConstructionDecl", this.e0); } private parse_OrderingModeDecl() { this.eventHandler.startNonterminal("OrderingModeDecl", this.e0); this.shift(109); // 'declare' this.lookahead1W(71); // S^WS | '(:' | 'ordering' this.shift(207); // 'ordering' this.lookahead1W(135); // S^WS | '(:' | 'ordered' | 'unordered' switch (this.l1) { case 206: // 'ordered' this.shift(206); // 'ordered' break; default: this.shift(262); // 'unordered' } this.eventHandler.endNonterminal("OrderingModeDecl", this.e0); } private parse_EmptyOrderDecl() { this.eventHandler.startNonterminal("EmptyOrderDecl", this.e0); this.shift(109); // 'declare' this.lookahead1W(49); // S^WS | '(:' | 'default' this.shift(110); // 'default' this.lookahead1W(70); // S^WS | '(:' | 'order' this.shift(205); // 'order' this.lookahead1W(52); // S^WS | '(:' | 'empty' this.shift(124); // 'empty' this.lookahead1W(125); // S^WS | '(:' | 'greatest' | 'least' switch (this.l1) { case 149: // 'greatest' this.shift(149); // 'greatest' break; default: this.shift(176); // 'least' } this.eventHandler.endNonterminal("EmptyOrderDecl", this.e0); } private try_EmptyOrderDecl() { this.shiftT(109); // 'declare' this.lookahead1W(49); // S^WS | '(:' | 'default' this.shiftT(110); // 'default' this.lookahead1W(70); // S^WS | '(:' | 'order' this.shiftT(205); // 'order' this.lookahead1W(52); // S^WS | '(:' | 'empty' this.shiftT(124); // 'empty' this.lookahead1W(125); // S^WS | '(:' | 'greatest' | 'least' switch (this.l1) { case 149: // 'greatest' this.shiftT(149); // 'greatest' break; default: this.shiftT(176); // 'least' } } private parse_CopyNamespacesDecl() { this.eventHandler.startNonterminal("CopyNamespacesDecl", this.e0); this.shift(109); // 'declare' this.lookahead1W(47); // S^WS | '(:' | 'copy-namespaces' this.shift(105); // 'copy-namespaces' this.lookahead1W(132); // S^WS | '(:' | 'no-preserve' | 'preserve' this.whitespace(); this.parse_PreserveMode(); this.lookahead1W(25); // S^WS | '(:' | ',' this.shift(42); // ',' this.lookahead1W(127); // 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 218: // 'preserve' this.shift(218); // 'preserve' break; default: this.shift(193); // 'no-preserve' } this.eventHandler.endNonterminal("PreserveMode", this.e0); } private parse_InheritMode() { this.eventHandler.startNonterminal("InheritMode", this.e0); switch (this.l1) { case 159: // 'inherit' this.shift(159); // 'inherit' break; default: this.shift(192); // 'no-inherit' } this.eventHandler.endNonterminal("InheritMode", this.e0); } private parse_DecimalFormatDecl() { this.eventHandler.startNonterminal("DecimalFormatDecl", this.e0); this.shift(109); // 'declare' this.lookahead1W(118); // S^WS | '(:' | 'decimal-format' | 'default' switch (this.l1) { case 107: // 'decimal-format' this.shift(107); // 'decimal-format' this.lookahead1W(245); // 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' | 'false' | // 'first' | 'following' | 'following-sibling' | 'for' | 'from' | 'ft-option' | // 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | // 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | // 'json' | 'json-item' | 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | // 'mod' | 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | // 'nodes' | 'null' | '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' | 'select' | 'self' | 'sliding' | 'some' | 'stable' | 'start' | // 'strict' | 'structured-item' | 'switch' | 'text' | 'to' | 'treat' | 'true' | // 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' | // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' this.whitespace(); this.parse_EQName(); break; default: this.shift(110); // 'default' this.lookahead1W(48); // S^WS | '(:' | 'decimal-format' this.shift(107); // 'decimal-format' } for (;;) { this.lookahead1W(203); // S^WS | '(:' | ';' | 'NaN' | 'decimal-separator' | 'digit' | // 'grouping-separator' | 'infinity' | 'minus-sign' | 'pattern-separator' | // 'per-mille' | 'percent' | 'zero-digit' if (this.l1 == 54) // ';' { break; } this.whitespace(); this.parse_DFPropertyName(); this.lookahead1W(30); // S^WS | '(:' | '=' this.shift(61); // '=' 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 108: // 'decimal-separator' this.shift(108); // 'decimal-separator' break; case 151: // 'grouping-separator' this.shift(151); // 'grouping-separator' break; case 158: // 'infinity' this.shift(158); // 'infinity' break; case 182: // 'minus-sign' this.shift(182); // 'minus-sign' break; case 68: // 'NaN' this.shift(68); // 'NaN' break; case 213: // 'percent' this.shift(213); // 'percent' break; case 212: // 'per-mille' this.shift(212); // 'per-mille' break; case 280: // 'zero-digit' this.shift(280); // 'zero-digit' break; case 117: // 'digit' this.shift(117); // 'digit' break; default: this.shift(211); // 'pattern-separator' } this.eventHandler.endNonterminal("DFPropertyName", this.e0); } private parse_Import() { this.eventHandler.startNonterminal("Import", this.e0); switch (this.l1) { case 155: // 'import' this.lookahead2W(130); // S^WS | '(:' | 'module' | 'schema' break; default: this.lk = this.l1; } switch (this.lk) { case 117403: // '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(155); // 'import' this.lookahead1W(76); // S^WS | '(:' | 'schema' this.shift(229); // 'schema' this.lookahead1W(141); // 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(112); // S^WS | '(:' | ';' | 'at' if (this.l1 == 82) // 'at' { this.shift(82); // 'at' this.lookahead1W(15); // URILiteral | S^WS | '(:' this.shift(7); // URILiteral for (;;) { this.lookahead1W(107); // S^WS | '(:' | ',' | ';' if (this.l1 != 42) // ',' { break; } this.shift(42); // ',' 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 187: // 'namespace' this.shift(187); // 'namespace' this.lookahead1W(239); // 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' | 'false' | 'first' | 'following' | // 'following-sibling' | 'for' | 'from' | 'ft-option' | 'function' | 'ge' | // 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' | // 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | 'json' | // 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' | 'modify' | // 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' | 'null' | // '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' | 'select' | 'self' | // 'sliding' | 'some' | 'stable' | 'start' | 'strict' | 'switch' | 'text' | 'to' | // 'treat' | 'true' | 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | // 'unordered' | 'updating' | 'validate' | 'value' | 'variable' | 'version' | // 'where' | 'while' | 'with' this.whitespace(); this.parse_NCName(); this.lookahead1W(30); // S^WS | '(:' | '=' this.shift(61); // '=' break; default: this.shift(110); // 'default' this.lookahead1W(50); // S^WS | '(:' | 'element' this.shift(122); // 'element' this.lookahead1W(64); // S^WS | '(:' | 'namespace' this.shift(187); // 'namespace' } this.eventHandler.endNonterminal("SchemaPrefix", this.e0); } private parse_ModuleImport() { this.eventHandler.startNonterminal("ModuleImport", this.e0); this.shift(155); // 'import' this.lookahead1W(63); // S^WS | '(:' | 'module' this.shift(185); // 'module' this.lookahead1W(93); // URILiteral | S^WS | '(:' | 'namespace' if (this.l1 == 187) // 'namespace' { this.shift(187); // 'namespace' this.lookahead1W(239); // 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' | 'false' | 'first' | 'following' | // 'following-sibling' | 'for' | 'from' | 'ft-option' | 'function' | 'ge' | // 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' | // 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | 'json' | // 'jsoniq' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' | 'modify' | // 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' | 'null' | // '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' | 'select' | 'self' | // 'sliding' | 'some' | 'stable' | 'start' | 'strict' | 'switch' | 'text' | 'to' | // 'treat' | 'true' | 'try' | 'tumbling' | 'type' | 'typeswitch' | 'union' | // 'unordered' | 'updating' | 'validate' | 'value' | 'variable' | 'version' | // 'where' | 'while' | 'with' this.whitespace(); this.parse_NCName(); this.lookahead1W(30); // S^WS | '(:' | '=' this.shift(61); // '='