Fix bugs in the XQuery parser and lexer.
This commit is contained in:
parent
b7ab8aa2f6
commit
afa970767a
10 changed files with 140065 additions and 133838 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,11 @@
|
||||||
// $ANTLR 3.3 Nov 30, 2010 12:50:56 StringLexer.g 2012-04-03 22:00:05
|
define(function(require, exports, module) {
|
||||||
|
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/StringLexer.g 2012-04-09 19:06:41
|
||||||
|
|
||||||
|
var org = require("./antlr3-all").org;
|
||||||
|
var XQDTLexer = require("./XQDTLexer").XQDTLexer;
|
||||||
|
|
||||||
|
|
||||||
|
var StringLexer = function(input, state) {
|
||||||
define(function(require, exports, module){
|
|
||||||
var org = require("./antlr3-all").org;
|
|
||||||
var XQDTLexer = require("./XQDTLexer").XQDTLexer;
|
|
||||||
|
|
||||||
var StringLexer = exports.StringLexer = function(input, state) {
|
|
||||||
// alternate constructor @todo
|
// alternate constructor @todo
|
||||||
// public StringLexer(CharStream input)
|
// public StringLexer(CharStream input)
|
||||||
// public StringLexer(CharStream input, RecognizerSharedState state) {
|
// public StringLexer(CharStream input, RecognizerSharedState state) {
|
||||||
|
|
@ -154,109 +153,109 @@ org.antlr.lang.augmentObject(StringLexer, {
|
||||||
COUNT: 115,
|
COUNT: 115,
|
||||||
DECIMAL_FORMAT: 116,
|
DECIMAL_FORMAT: 116,
|
||||||
DECIMAL_SEPARATOR: 117,
|
DECIMAL_SEPARATOR: 117,
|
||||||
DETERMINISTIC: 118,
|
DIGIT: 118,
|
||||||
DIGIT: 119,
|
END: 119,
|
||||||
END: 120,
|
GROUP: 120,
|
||||||
GROUP: 121,
|
GROUPING_SEPARATOR: 121,
|
||||||
GROUPING_SEPARATOR: 122,
|
INFINITY: 122,
|
||||||
INFINITY: 123,
|
MINUS_SIGN: 123,
|
||||||
MINUS_SIGN: 124,
|
NAMESPACE_NODE: 124,
|
||||||
NAMESPACE_NODE: 125,
|
NAN: 125,
|
||||||
NAN: 126,
|
NEXT: 126,
|
||||||
NEXT: 127,
|
ONLY: 127,
|
||||||
ONLY: 128,
|
PATTERN_SEPARATOR: 128,
|
||||||
PATTERN_SEPARATOR: 129,
|
PERCENT: 129,
|
||||||
PERCENT: 130,
|
PER_MILLE: 130,
|
||||||
PER_MILLE: 131,
|
PREVIOUS: 131,
|
||||||
PREVIOUS: 132,
|
SLIDING: 132,
|
||||||
SLIDING: 133,
|
START: 133,
|
||||||
START: 134,
|
SWITCH: 134,
|
||||||
SWITCH: 135,
|
TRY: 135,
|
||||||
TRY: 136,
|
TUMBLING: 136,
|
||||||
TUMBLING: 137,
|
TYPE: 137,
|
||||||
TYPE: 138,
|
WHEN: 138,
|
||||||
WHEN: 139,
|
WINDOW: 139,
|
||||||
WINDOW: 140,
|
ZERO_DIGIT: 140,
|
||||||
ZERO_DIGIT: 141,
|
AFTER: 141,
|
||||||
AFTER: 142,
|
BEFORE: 142,
|
||||||
BEFORE: 143,
|
COPY: 143,
|
||||||
COPY: 144,
|
DELETE: 144,
|
||||||
DELETE: 145,
|
FIRST: 145,
|
||||||
FIRST: 146,
|
INSERT: 146,
|
||||||
INSERT: 147,
|
INTO: 147,
|
||||||
INTO: 148,
|
LAST: 148,
|
||||||
LAST: 149,
|
MODIFY: 149,
|
||||||
MODIFY: 150,
|
NODES: 150,
|
||||||
NODES: 151,
|
RENAME: 151,
|
||||||
RENAME: 152,
|
REPLACE: 152,
|
||||||
REPLACE: 153,
|
REVALIDATION: 153,
|
||||||
REVALIDATION: 154,
|
SKIP: 154,
|
||||||
SKIP: 155,
|
UPDATING: 155,
|
||||||
UPDATING: 156,
|
VALUE: 156,
|
||||||
VALUE: 157,
|
WITH: 157,
|
||||||
WITH: 158,
|
ALL: 158,
|
||||||
ALL: 159,
|
ANY: 159,
|
||||||
ANY: 160,
|
CONTAINS: 160,
|
||||||
CONTAINS: 161,
|
CONTENT: 161,
|
||||||
CONTENT: 162,
|
DIACRITICS: 162,
|
||||||
DIACRITICS: 163,
|
DIFFERENT: 163,
|
||||||
DIFFERENT: 164,
|
DISTANCE: 164,
|
||||||
DISTANCE: 165,
|
ENTIRE: 165,
|
||||||
ENTIRE: 166,
|
EXACTLY: 166,
|
||||||
EXACTLY: 167,
|
FROM: 167,
|
||||||
FROM: 168,
|
FT_OPTION: 168,
|
||||||
FT_OPTION: 169,
|
FTAND: 169,
|
||||||
FTAND: 170,
|
FTNOT: 170,
|
||||||
FTNOT: 171,
|
FTOR: 171,
|
||||||
FTOR: 172,
|
INSENSITIVE: 172,
|
||||||
INSENSITIVE: 173,
|
LANGUAGE: 173,
|
||||||
LANGUAGE: 174,
|
LEVELS: 174,
|
||||||
LEVELS: 175,
|
LOWERCASE: 175,
|
||||||
LOWERCASE: 176,
|
MOST: 176,
|
||||||
MOST: 177,
|
NO: 177,
|
||||||
NO: 178,
|
NOT: 178,
|
||||||
NOT: 179,
|
OCCURS: 179,
|
||||||
OCCURS: 180,
|
PARAGRAPH: 180,
|
||||||
PARAGRAPH: 181,
|
PARAGRAPHS: 181,
|
||||||
PARAGRAPHS: 182,
|
PHRASE: 182,
|
||||||
PHRASE: 183,
|
RELATIONSHIP: 183,
|
||||||
RELATIONSHIP: 184,
|
SAME: 184,
|
||||||
SAME: 185,
|
SCORE: 185,
|
||||||
SCORE: 186,
|
SENSITIVE: 186,
|
||||||
SENSITIVE: 187,
|
SENTENCE: 187,
|
||||||
SENTENCE: 188,
|
SENTENCES: 188,
|
||||||
SENTENCES: 189,
|
STEMMING: 189,
|
||||||
STEMMING: 190,
|
STOP: 190,
|
||||||
STOP: 191,
|
THESAURUS: 191,
|
||||||
THESAURUS: 192,
|
TIMES: 192,
|
||||||
TIMES: 193,
|
UPPERCASE: 193,
|
||||||
UPPERCASE: 194,
|
USING: 194,
|
||||||
USING: 195,
|
WEIGHT: 195,
|
||||||
WEIGHT: 196,
|
WILDCARDS: 196,
|
||||||
WILDCARDS: 197,
|
WITHOUT: 197,
|
||||||
WITHOUT: 198,
|
WORD: 198,
|
||||||
WORD: 199,
|
WORDS: 199,
|
||||||
WORDS: 200,
|
BREAK: 200,
|
||||||
BREAK: 201,
|
CONTINUE: 201,
|
||||||
CONTINUE: 202,
|
EXIT: 202,
|
||||||
EXIT: 203,
|
LOOP: 203,
|
||||||
LOOP: 204,
|
RETURNING: 204,
|
||||||
RETURNING: 205,
|
WHILE: 205,
|
||||||
WHILE: 206,
|
CHECK: 206,
|
||||||
CHECK: 207,
|
COLLECTION: 207,
|
||||||
COLLECTION: 208,
|
CONSTRAINT: 208,
|
||||||
CONSTRAINT: 209,
|
FOREACH: 209,
|
||||||
FOREACH: 210,
|
FOREIGN: 210,
|
||||||
FOREIGN: 211,
|
INDEX: 211,
|
||||||
INDEX: 212,
|
INTEGRITY: 212,
|
||||||
INTEGRITY: 213,
|
KEY: 213,
|
||||||
KEY: 214,
|
ON: 214,
|
||||||
ON: 215,
|
UNIQUE: 215,
|
||||||
UNIQUE: 216,
|
BINARY: 216,
|
||||||
BINARY: 217,
|
AMP_ER: 217,
|
||||||
AMP_ER: 218,
|
APOS_ER: 218,
|
||||||
APOS_ER: 219,
|
QUOT_ER: 219,
|
||||||
QUOT_ER: 220,
|
CONCAT: 220,
|
||||||
LPAREN: 221,
|
LPAREN: 221,
|
||||||
RPAREN: 222,
|
RPAREN: 222,
|
||||||
DOLLAR: 223,
|
DOLLAR: 223,
|
||||||
|
|
@ -442,109 +441,109 @@ org.antlr.lang.extend(StringLexer, XQDTLexer, {
|
||||||
COUNT : 115,
|
COUNT : 115,
|
||||||
DECIMAL_FORMAT : 116,
|
DECIMAL_FORMAT : 116,
|
||||||
DECIMAL_SEPARATOR : 117,
|
DECIMAL_SEPARATOR : 117,
|
||||||
DETERMINISTIC : 118,
|
DIGIT : 118,
|
||||||
DIGIT : 119,
|
END : 119,
|
||||||
END : 120,
|
GROUP : 120,
|
||||||
GROUP : 121,
|
GROUPING_SEPARATOR : 121,
|
||||||
GROUPING_SEPARATOR : 122,
|
INFINITY : 122,
|
||||||
INFINITY : 123,
|
MINUS_SIGN : 123,
|
||||||
MINUS_SIGN : 124,
|
NAMESPACE_NODE : 124,
|
||||||
NAMESPACE_NODE : 125,
|
NAN : 125,
|
||||||
NAN : 126,
|
NEXT : 126,
|
||||||
NEXT : 127,
|
ONLY : 127,
|
||||||
ONLY : 128,
|
PATTERN_SEPARATOR : 128,
|
||||||
PATTERN_SEPARATOR : 129,
|
PERCENT : 129,
|
||||||
PERCENT : 130,
|
PER_MILLE : 130,
|
||||||
PER_MILLE : 131,
|
PREVIOUS : 131,
|
||||||
PREVIOUS : 132,
|
SLIDING : 132,
|
||||||
SLIDING : 133,
|
START : 133,
|
||||||
START : 134,
|
SWITCH : 134,
|
||||||
SWITCH : 135,
|
TRY : 135,
|
||||||
TRY : 136,
|
TUMBLING : 136,
|
||||||
TUMBLING : 137,
|
TYPE : 137,
|
||||||
TYPE : 138,
|
WHEN : 138,
|
||||||
WHEN : 139,
|
WINDOW : 139,
|
||||||
WINDOW : 140,
|
ZERO_DIGIT : 140,
|
||||||
ZERO_DIGIT : 141,
|
AFTER : 141,
|
||||||
AFTER : 142,
|
BEFORE : 142,
|
||||||
BEFORE : 143,
|
COPY : 143,
|
||||||
COPY : 144,
|
DELETE : 144,
|
||||||
DELETE : 145,
|
FIRST : 145,
|
||||||
FIRST : 146,
|
INSERT : 146,
|
||||||
INSERT : 147,
|
INTO : 147,
|
||||||
INTO : 148,
|
LAST : 148,
|
||||||
LAST : 149,
|
MODIFY : 149,
|
||||||
MODIFY : 150,
|
NODES : 150,
|
||||||
NODES : 151,
|
RENAME : 151,
|
||||||
RENAME : 152,
|
REPLACE : 152,
|
||||||
REPLACE : 153,
|
REVALIDATION : 153,
|
||||||
REVALIDATION : 154,
|
SKIP : 154,
|
||||||
SKIP : 155,
|
UPDATING : 155,
|
||||||
UPDATING : 156,
|
VALUE : 156,
|
||||||
VALUE : 157,
|
WITH : 157,
|
||||||
WITH : 158,
|
ALL : 158,
|
||||||
ALL : 159,
|
ANY : 159,
|
||||||
ANY : 160,
|
CONTAINS : 160,
|
||||||
CONTAINS : 161,
|
CONTENT : 161,
|
||||||
CONTENT : 162,
|
DIACRITICS : 162,
|
||||||
DIACRITICS : 163,
|
DIFFERENT : 163,
|
||||||
DIFFERENT : 164,
|
DISTANCE : 164,
|
||||||
DISTANCE : 165,
|
ENTIRE : 165,
|
||||||
ENTIRE : 166,
|
EXACTLY : 166,
|
||||||
EXACTLY : 167,
|
FROM : 167,
|
||||||
FROM : 168,
|
FT_OPTION : 168,
|
||||||
FT_OPTION : 169,
|
FTAND : 169,
|
||||||
FTAND : 170,
|
FTNOT : 170,
|
||||||
FTNOT : 171,
|
FTOR : 171,
|
||||||
FTOR : 172,
|
INSENSITIVE : 172,
|
||||||
INSENSITIVE : 173,
|
LANGUAGE : 173,
|
||||||
LANGUAGE : 174,
|
LEVELS : 174,
|
||||||
LEVELS : 175,
|
LOWERCASE : 175,
|
||||||
LOWERCASE : 176,
|
MOST : 176,
|
||||||
MOST : 177,
|
NO : 177,
|
||||||
NO : 178,
|
NOT : 178,
|
||||||
NOT : 179,
|
OCCURS : 179,
|
||||||
OCCURS : 180,
|
PARAGRAPH : 180,
|
||||||
PARAGRAPH : 181,
|
PARAGRAPHS : 181,
|
||||||
PARAGRAPHS : 182,
|
PHRASE : 182,
|
||||||
PHRASE : 183,
|
RELATIONSHIP : 183,
|
||||||
RELATIONSHIP : 184,
|
SAME : 184,
|
||||||
SAME : 185,
|
SCORE : 185,
|
||||||
SCORE : 186,
|
SENSITIVE : 186,
|
||||||
SENSITIVE : 187,
|
SENTENCE : 187,
|
||||||
SENTENCE : 188,
|
SENTENCES : 188,
|
||||||
SENTENCES : 189,
|
STEMMING : 189,
|
||||||
STEMMING : 190,
|
STOP : 190,
|
||||||
STOP : 191,
|
THESAURUS : 191,
|
||||||
THESAURUS : 192,
|
TIMES : 192,
|
||||||
TIMES : 193,
|
UPPERCASE : 193,
|
||||||
UPPERCASE : 194,
|
USING : 194,
|
||||||
USING : 195,
|
WEIGHT : 195,
|
||||||
WEIGHT : 196,
|
WILDCARDS : 196,
|
||||||
WILDCARDS : 197,
|
WITHOUT : 197,
|
||||||
WITHOUT : 198,
|
WORD : 198,
|
||||||
WORD : 199,
|
WORDS : 199,
|
||||||
WORDS : 200,
|
BREAK : 200,
|
||||||
BREAK : 201,
|
CONTINUE : 201,
|
||||||
CONTINUE : 202,
|
EXIT : 202,
|
||||||
EXIT : 203,
|
LOOP : 203,
|
||||||
LOOP : 204,
|
RETURNING : 204,
|
||||||
RETURNING : 205,
|
WHILE : 205,
|
||||||
WHILE : 206,
|
CHECK : 206,
|
||||||
CHECK : 207,
|
COLLECTION : 207,
|
||||||
COLLECTION : 208,
|
CONSTRAINT : 208,
|
||||||
CONSTRAINT : 209,
|
FOREACH : 209,
|
||||||
FOREACH : 210,
|
FOREIGN : 210,
|
||||||
FOREIGN : 211,
|
INDEX : 211,
|
||||||
INDEX : 212,
|
INTEGRITY : 212,
|
||||||
INTEGRITY : 213,
|
KEY : 213,
|
||||||
KEY : 214,
|
ON : 214,
|
||||||
ON : 215,
|
UNIQUE : 215,
|
||||||
UNIQUE : 216,
|
BINARY : 216,
|
||||||
BINARY : 217,
|
AMP_ER : 217,
|
||||||
AMP_ER : 218,
|
APOS_ER : 218,
|
||||||
APOS_ER : 219,
|
QUOT_ER : 219,
|
||||||
QUOT_ER : 220,
|
CONCAT : 220,
|
||||||
LPAREN : 221,
|
LPAREN : 221,
|
||||||
RPAREN : 222,
|
RPAREN : 222,
|
||||||
DOLLAR : 223,
|
DOLLAR : 223,
|
||||||
|
|
@ -609,7 +608,7 @@ org.antlr.lang.extend(StringLexer, XQDTLexer, {
|
||||||
L_AnyChar : 282,
|
L_AnyChar : 282,
|
||||||
L_QuotStringLiteralChar : 283,
|
L_QuotStringLiteralChar : 283,
|
||||||
L_AposStringLiteralChar : 284,
|
L_AposStringLiteralChar : 284,
|
||||||
getGrammarFileName: function() { return "StringLexer.g"; }
|
getGrammarFileName: function() { return "xquery/StringLexer.g"; }
|
||||||
});
|
});
|
||||||
org.antlr.lang.augmentObject(StringLexer.prototype, {
|
org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
// $ANTLR start QUOT
|
// $ANTLR start QUOT
|
||||||
|
|
@ -617,8 +616,8 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.QUOT;
|
var _type = this.QUOT;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:29:6: ({...}? => '\"' )
|
// xquery/StringLexer.g:31:6: ({...}? => '\"' )
|
||||||
// StringLexer.g:29:8: {...}? => '\"'
|
// xquery/StringLexer.g:31:8: {...}? => '\"'
|
||||||
if ( !(( this.inQuotStr )) ) {
|
if ( !(( this.inQuotStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "QUOT", " this.inQuotStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "QUOT", " this.inQuotStr ");
|
||||||
}
|
}
|
||||||
|
|
@ -640,8 +639,8 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.APOS;
|
var _type = this.APOS;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:30:6: ({...}? => '\\'' )
|
// xquery/StringLexer.g:32:6: ({...}? => '\\'' )
|
||||||
// StringLexer.g:30:8: {...}? => '\\''
|
// xquery/StringLexer.g:32:8: {...}? => '\\''
|
||||||
if ( !(( this.inAposStr )) ) {
|
if ( !(( this.inAposStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "APOS", " this.inAposStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "APOS", " this.inAposStr ");
|
||||||
}
|
}
|
||||||
|
|
@ -663,8 +662,8 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.ESCAPE_QUOT;
|
var _type = this.ESCAPE_QUOT;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:31:13: ({...}? => '\"\"' )
|
// xquery/StringLexer.g:33:13: ({...}? => '\"\"' )
|
||||||
// StringLexer.g:31:15: {...}? => '\"\"'
|
// xquery/StringLexer.g:33:15: {...}? => '\"\"'
|
||||||
if ( !(( this.inQuotStr )) ) {
|
if ( !(( this.inQuotStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_QUOT", " this.inQuotStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_QUOT", " this.inQuotStr ");
|
||||||
}
|
}
|
||||||
|
|
@ -686,8 +685,8 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.ESCAPE_APOS;
|
var _type = this.ESCAPE_APOS;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:32:13: ({...}? => '\\'\\'' )
|
// xquery/StringLexer.g:34:13: ({...}? => '\\'\\'' )
|
||||||
// StringLexer.g:32:15: {...}? => '\\'\\''
|
// xquery/StringLexer.g:34:15: {...}? => '\\'\\''
|
||||||
if ( !(( this.inAposStr )) ) {
|
if ( !(( this.inAposStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_APOS", " this.inAposStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_APOS", " this.inAposStr ");
|
||||||
}
|
}
|
||||||
|
|
@ -709,13 +708,13 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.L_PredefinedEntityRef;
|
var _type = this.L_PredefinedEntityRef;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:36:2: ({...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' )
|
// xquery/StringLexer.g:38:2: ({...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' )
|
||||||
// StringLexer.g:36:4: {...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';'
|
// xquery/StringLexer.g:38:4: {...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';'
|
||||||
if ( !(( this.inQuotStr | this.inAposStr )) ) {
|
if ( !(( this.inQuotStr | this.inAposStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_PredefinedEntityRef", " this.inQuotStr | this.inAposStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_PredefinedEntityRef", " this.inQuotStr | this.inAposStr ");
|
||||||
}
|
}
|
||||||
this.match('&');
|
this.match('&');
|
||||||
// StringLexer.g:36:48: ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' )
|
// xquery/StringLexer.g:38:48: ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' )
|
||||||
var alt1=5;
|
var alt1=5;
|
||||||
switch ( this.input.LA(1) ) {
|
switch ( this.input.LA(1) ) {
|
||||||
case 'l':
|
case 'l':
|
||||||
|
|
@ -752,35 +751,35 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
switch (alt1) {
|
switch (alt1) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:36:49: 'lt'
|
// xquery/StringLexer.g:38:49: 'lt'
|
||||||
this.match("lt");
|
this.match("lt");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
// StringLexer.g:36:56: 'gt'
|
// xquery/StringLexer.g:38:56: 'gt'
|
||||||
this.match("gt");
|
this.match("gt");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
// StringLexer.g:36:63: 'apos'
|
// xquery/StringLexer.g:38:63: 'apos'
|
||||||
this.match("apos");
|
this.match("apos");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
// StringLexer.g:36:72: 'quot'
|
// xquery/StringLexer.g:38:72: 'quot'
|
||||||
this.match("quot");
|
this.match("quot");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 5 :
|
case 5 :
|
||||||
// StringLexer.g:36:81: 'amp'
|
// xquery/StringLexer.g:38:81: 'amp'
|
||||||
this.match("amp");
|
this.match("amp");
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -806,7 +805,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.L_CharRef;
|
var _type = this.L_CharRef;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:41:2: ({...}? => '&#' ( '0' .. '9' )+ ';' | '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' )
|
// xquery/StringLexer.g:43:2: ({...}? => '&#' ( '0' .. '9' )+ ';' | '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' )
|
||||||
var alt4=2;
|
var alt4=2;
|
||||||
var LA4_0 = this.input.LA(1);
|
var LA4_0 = this.input.LA(1);
|
||||||
|
|
||||||
|
|
@ -844,13 +843,13 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
}
|
}
|
||||||
switch (alt4) {
|
switch (alt4) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:41:4: {...}? => '&#' ( '0' .. '9' )+ ';'
|
// xquery/StringLexer.g:43:4: {...}? => '&#' ( '0' .. '9' )+ ';'
|
||||||
if ( !(( this.inQuotStr | this.inAposStr )) ) {
|
if ( !(( this.inQuotStr | this.inAposStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_CharRef", " this.inQuotStr | this.inAposStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_CharRef", " this.inQuotStr | this.inAposStr ");
|
||||||
}
|
}
|
||||||
this.match("&#");
|
this.match("&#");
|
||||||
|
|
||||||
// StringLexer.g:41:49: ( '0' .. '9' )+
|
// xquery/StringLexer.g:43:49: ( '0' .. '9' )+
|
||||||
var cnt2=0;
|
var cnt2=0;
|
||||||
loop2:
|
loop2:
|
||||||
do {
|
do {
|
||||||
|
|
@ -864,7 +863,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
switch (alt2) {
|
switch (alt2) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:41:49: '0' .. '9'
|
// xquery/StringLexer.g:43:49: '0' .. '9'
|
||||||
this.matchRange('0','9');
|
this.matchRange('0','9');
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -885,10 +884,10 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
// StringLexer.g:41:65: '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';'
|
// xquery/StringLexer.g:43:65: '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';'
|
||||||
this.match("&#x");
|
this.match("&#x");
|
||||||
|
|
||||||
// StringLexer.g:41:71: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
|
// xquery/StringLexer.g:43:71: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
|
||||||
var cnt3=0;
|
var cnt3=0;
|
||||||
loop3:
|
loop3:
|
||||||
do {
|
do {
|
||||||
|
|
@ -902,7 +901,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
switch (alt3) {
|
switch (alt3) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:
|
// xquery/StringLexer.g:
|
||||||
if ( (this.input.LA(1)>='0' && this.input.LA(1)<='9')||(this.input.LA(1)>='A' && this.input.LA(1)<='F')||(this.input.LA(1)>='a' && this.input.LA(1)<='f') ) {
|
if ( (this.input.LA(1)>='0' && this.input.LA(1)<='9')||(this.input.LA(1)>='A' && this.input.LA(1)<='F')||(this.input.LA(1)>='a' && this.input.LA(1)<='f') ) {
|
||||||
this.input.consume();
|
this.input.consume();
|
||||||
|
|
||||||
|
|
@ -945,12 +944,12 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.L_QuotStringLiteralChar;
|
var _type = this.L_QuotStringLiteralChar;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:45:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
|
// xquery/StringLexer.g:47:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
|
||||||
// StringLexer.g:45:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
// xquery/StringLexer.g:47:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
||||||
if ( !(( this.inQuotStr )) ) {
|
if ( !(( this.inQuotStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_QuotStringLiteralChar", " this.inQuotStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_QuotStringLiteralChar", " this.inQuotStr ");
|
||||||
}
|
}
|
||||||
// StringLexer.g:46:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
// xquery/StringLexer.g:48:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
||||||
var cnt5=0;
|
var cnt5=0;
|
||||||
loop5:
|
loop5:
|
||||||
do {
|
do {
|
||||||
|
|
@ -964,7 +963,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
switch (alt5) {
|
switch (alt5) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:
|
// xquery/StringLexer.g:
|
||||||
if ( (this.input.LA(1)>='\t' && this.input.LA(1)<='\n')||this.input.LA(1)=='\r'||(this.input.LA(1)>=' ' && this.input.LA(1)<='!')||(this.input.LA(1)>='#' && this.input.LA(1)<='%')||(this.input.LA(1)>='\'' && this.input.LA(1)<='\uD7FF')||(this.input.LA(1)>='\uE000' && this.input.LA(1)<='\uFFFD') ) {
|
if ( (this.input.LA(1)>='\t' && this.input.LA(1)<='\n')||this.input.LA(1)=='\r'||(this.input.LA(1)>=' ' && this.input.LA(1)<='!')||(this.input.LA(1)>='#' && this.input.LA(1)<='%')||(this.input.LA(1)>='\'' && this.input.LA(1)<='\uD7FF')||(this.input.LA(1)>='\uE000' && this.input.LA(1)<='\uFFFD') ) {
|
||||||
this.input.consume();
|
this.input.consume();
|
||||||
|
|
||||||
|
|
@ -1004,12 +1003,12 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.L_AposStringLiteralChar;
|
var _type = this.L_AposStringLiteralChar;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:51:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
|
// xquery/StringLexer.g:53:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
|
||||||
// StringLexer.g:51:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
// xquery/StringLexer.g:53:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
||||||
if ( !(( this.inAposStr )) ) {
|
if ( !(( this.inAposStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_AposStringLiteralChar", " this.inAposStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_AposStringLiteralChar", " this.inAposStr ");
|
||||||
}
|
}
|
||||||
// StringLexer.g:52:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
// xquery/StringLexer.g:54:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
||||||
var cnt6=0;
|
var cnt6=0;
|
||||||
loop6:
|
loop6:
|
||||||
do {
|
do {
|
||||||
|
|
@ -1023,7 +1022,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
switch (alt6) {
|
switch (alt6) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:
|
// xquery/StringLexer.g:
|
||||||
if ( (this.input.LA(1)>='\t' && this.input.LA(1)<='\n')||this.input.LA(1)=='\r'||(this.input.LA(1)>=' ' && this.input.LA(1)<='%')||(this.input.LA(1)>='(' && this.input.LA(1)<='\uD7FF')||(this.input.LA(1)>='\uE000' && this.input.LA(1)<='\uFFFD') ) {
|
if ( (this.input.LA(1)>='\t' && this.input.LA(1)<='\n')||this.input.LA(1)=='\r'||(this.input.LA(1)>=' ' && this.input.LA(1)<='%')||(this.input.LA(1)>='(' && this.input.LA(1)<='\uD7FF')||(this.input.LA(1)>='\uE000' && this.input.LA(1)<='\uFFFD') ) {
|
||||||
this.input.consume();
|
this.input.consume();
|
||||||
|
|
||||||
|
|
@ -1063,12 +1062,12 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
try {
|
try {
|
||||||
var _type = this.L_AnyChar;
|
var _type = this.L_AnyChar;
|
||||||
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
|
||||||
// StringLexer.g:61:5: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
|
// xquery/StringLexer.g:63:5: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
|
||||||
// StringLexer.g:61:9: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
// xquery/StringLexer.g:63:9: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
||||||
if ( !(( !this.inQuotStr && !this.inAposStr )) ) {
|
if ( !(( !this.inQuotStr && !this.inAposStr )) ) {
|
||||||
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_AnyChar", " !this.inQuotStr && !this.inAposStr ");
|
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_AnyChar", " !this.inQuotStr && !this.inAposStr ");
|
||||||
}
|
}
|
||||||
// StringLexer.g:62:9: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
// xquery/StringLexer.g:64:9: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
|
||||||
var cnt7=0;
|
var cnt7=0;
|
||||||
loop7:
|
loop7:
|
||||||
do {
|
do {
|
||||||
|
|
@ -1082,7 +1081,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
|
|
||||||
switch (alt7) {
|
switch (alt7) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:
|
// xquery/StringLexer.g:
|
||||||
if ( (this.input.LA(1)>='\t' && this.input.LA(1)<='\n')||this.input.LA(1)=='\r'||(this.input.LA(1)>=' ' && this.input.LA(1)<='%')||(this.input.LA(1)>='\'' && this.input.LA(1)<=';')||(this.input.LA(1)>='=' && this.input.LA(1)<='z')||this.input.LA(1)=='|'||(this.input.LA(1)>='~' && this.input.LA(1)<='\uD7FF')||(this.input.LA(1)>='\uE000' && this.input.LA(1)<='\uFFFD') ) {
|
if ( (this.input.LA(1)>='\t' && this.input.LA(1)<='\n')||this.input.LA(1)=='\r'||(this.input.LA(1)>=' ' && this.input.LA(1)<='%')||(this.input.LA(1)>='\'' && this.input.LA(1)<=';')||(this.input.LA(1)>='=' && this.input.LA(1)<='z')||this.input.LA(1)=='|'||(this.input.LA(1)>='~' && this.input.LA(1)<='\uD7FF')||(this.input.LA(1)>='\uE000' && this.input.LA(1)<='\uFFFD') ) {
|
||||||
this.input.consume();
|
this.input.consume();
|
||||||
|
|
||||||
|
|
@ -1118,60 +1117,60 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
|
||||||
// $ANTLR end "L_AnyChar",
|
// $ANTLR end "L_AnyChar",
|
||||||
|
|
||||||
mTokens: function() {
|
mTokens: function() {
|
||||||
// StringLexer.g:1:8: ( QUOT | APOS | ESCAPE_QUOT | ESCAPE_APOS | L_PredefinedEntityRef | L_CharRef | L_QuotStringLiteralChar | L_AposStringLiteralChar | L_AnyChar )
|
// xquery/StringLexer.g:1:8: ( QUOT | APOS | ESCAPE_QUOT | ESCAPE_APOS | L_PredefinedEntityRef | L_CharRef | L_QuotStringLiteralChar | L_AposStringLiteralChar | L_AnyChar )
|
||||||
var alt8=9;
|
var alt8=9;
|
||||||
alt8 = this.dfa8.predict(this.input);
|
alt8 = this.dfa8.predict(this.input);
|
||||||
switch (alt8) {
|
switch (alt8) {
|
||||||
case 1 :
|
case 1 :
|
||||||
// StringLexer.g:1:10: QUOT
|
// xquery/StringLexer.g:1:10: QUOT
|
||||||
this.mQUOT();
|
this.mQUOT();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
// StringLexer.g:1:15: APOS
|
// xquery/StringLexer.g:1:15: APOS
|
||||||
this.mAPOS();
|
this.mAPOS();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
// StringLexer.g:1:20: ESCAPE_QUOT
|
// xquery/StringLexer.g:1:20: ESCAPE_QUOT
|
||||||
this.mESCAPE_QUOT();
|
this.mESCAPE_QUOT();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
// StringLexer.g:1:32: ESCAPE_APOS
|
// xquery/StringLexer.g:1:32: ESCAPE_APOS
|
||||||
this.mESCAPE_APOS();
|
this.mESCAPE_APOS();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 5 :
|
case 5 :
|
||||||
// StringLexer.g:1:44: L_PredefinedEntityRef
|
// xquery/StringLexer.g:1:44: L_PredefinedEntityRef
|
||||||
this.mL_PredefinedEntityRef();
|
this.mL_PredefinedEntityRef();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 6 :
|
case 6 :
|
||||||
// StringLexer.g:1:66: L_CharRef
|
// xquery/StringLexer.g:1:66: L_CharRef
|
||||||
this.mL_CharRef();
|
this.mL_CharRef();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 7 :
|
case 7 :
|
||||||
// StringLexer.g:1:76: L_QuotStringLiteralChar
|
// xquery/StringLexer.g:1:76: L_QuotStringLiteralChar
|
||||||
this.mL_QuotStringLiteralChar();
|
this.mL_QuotStringLiteralChar();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 8 :
|
case 8 :
|
||||||
// StringLexer.g:1:100: L_AposStringLiteralChar
|
// xquery/StringLexer.g:1:100: L_AposStringLiteralChar
|
||||||
this.mL_AposStringLiteralChar();
|
this.mL_AposStringLiteralChar();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 9 :
|
case 9 :
|
||||||
// StringLexer.g:1:124: L_AnyChar
|
// xquery/StringLexer.g:1:124: L_AnyChar
|
||||||
this.mL_AnyChar();
|
this.mL_AnyChar();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1648,5 +1647,5 @@ org.antlr.lang.extend(StringLexer.DFA8, org.antlr.runtime.DFA, {
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
exports.StringLexer = StringLexer;
|
||||||
});
|
});
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -10,9 +10,11 @@ var XQDTLexer = exports.XQDTLexer = function(input, state)
|
||||||
org.antlr.lang.extend(XQDTLexer, org.antlr.runtime.Lexer, {
|
org.antlr.lang.extend(XQDTLexer, org.antlr.runtime.Lexer, {
|
||||||
|
|
||||||
isWsExplicit: false,
|
isWsExplicit: false,
|
||||||
|
|
||||||
setIsWsExplicit: function (wsExplicit) {
|
setIsWsExplicit: function (wsExplicit) {
|
||||||
isWsExplicit = wsExplicit;
|
//console.log("A WS: " + wsExplicit);
|
||||||
|
this.isWsExplicit = wsExplicit;
|
||||||
|
//console.log("B WS: " + wsExplicit);
|
||||||
},
|
},
|
||||||
|
|
||||||
addToStack: function (stack) {
|
addToStack: function (stack) {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -23,7 +23,6 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
this.isWsExplicit = false;
|
this.isWsExplicit = false;
|
||||||
this.p = 0;
|
this.p = 0;
|
||||||
this.channel = org.antlr.runtime.Token.DEFAULT_CHANNEL;
|
this.channel = org.antlr.runtime.Token.DEFAULT_CHANNEL;
|
||||||
this.lastMarker = null;
|
|
||||||
|
|
||||||
this.LT = function(k) {
|
this.LT = function(k) {
|
||||||
if (k == 0)
|
if (k == 0)
|
||||||
|
|
@ -37,7 +36,8 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
this.get = function(i) {
|
this.get = function(i) {
|
||||||
if (i >= this.tokens.length)
|
if (i >= this.tokens.length)
|
||||||
return org.antlr.runtime.Token.EOF_TOKEN;
|
return org.antlr.runtime.Token.EOF_TOKEN;
|
||||||
return this.tokens[i];
|
else
|
||||||
|
return this.tokens[i];
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTokenSource = function() {
|
this.getTokenSource = function() {
|
||||||
|
|
@ -93,8 +93,9 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this.consume = function() {
|
this.consume = function() {
|
||||||
if (this.done)
|
if (this.done) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
this.p++;
|
this.p++;
|
||||||
if (!this.isWsExplicit) {
|
if (!this.isWsExplicit) {
|
||||||
this.jumpToFirstValidToken();
|
this.jumpToFirstValidToken();
|
||||||
|
|
@ -118,10 +119,11 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.rewind = function(marker) {
|
this.rewind = function(marker) {
|
||||||
if(marker == undefined)
|
if(arguments.length == 1) {
|
||||||
this.seek(this.lastMarker);
|
|
||||||
else
|
|
||||||
this.seek(marker);
|
this.seek(marker);
|
||||||
|
} else {
|
||||||
|
this.seek(this.lastMarker);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.seek = function(index) {
|
this.seek = function(index) {
|
||||||
|
|
@ -136,7 +138,6 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
this.setTokenSource = function(source) {
|
this.setTokenSource = function(source) {
|
||||||
this.tokenSource = source;
|
this.tokenSource = source;
|
||||||
this.setWsExplicit(source.isWsExplicit);
|
this.setWsExplicit(source.isWsExplicit);
|
||||||
|
|
||||||
// un-read the unused tokens
|
// un-read the unused tokens
|
||||||
// they are different for the new source
|
// they are different for the new source
|
||||||
if (this.p < this.tokens.length) {
|
if (this.p < this.tokens.length) {
|
||||||
|
|
@ -156,7 +157,7 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
this.setWsExplicit = function(explicit) {
|
this.setWsExplicit = function(explicit) {
|
||||||
this.isWsExplicit = explicit;
|
this.isWsExplicit = explicit;
|
||||||
if (!explicit) {
|
if (!explicit) {
|
||||||
this.jumpToFirstValidToken();
|
this.jumpToFirstValidToken();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -178,9 +179,8 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
t.setTokenIndex(count++);
|
t.setTokenIndex(count++);
|
||||||
this.tokens.push(t);
|
this.tokens.push(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isWsExplicit || t.getChannel() == this.channel) {
|
if (this.isWsExplicit || t.getChannel() == this.channel) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
@ -215,7 +215,7 @@ var NewLazyTokenStream = exports.NewLazyTokenStream = function(tokenSource) {
|
||||||
t = this.tokenSource.nextToken();
|
t = this.tokenSource.nextToken();
|
||||||
if (t == org.antlr.runtime.Token.EOF_TOKEN)
|
if (t == org.antlr.runtime.Token.EOF_TOKEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t.setTokenIndex(this.p + i);
|
t.setTokenIndex(this.p + i);
|
||||||
this.tokens.push(t);
|
this.tokens.push(t);
|
||||||
}
|
}
|
||||||
|
|
@ -3001,6 +3001,7 @@ org.antlr.runtime.ANTLRStringStream.prototype = {
|
||||||
* Consume the next character of data in the stream.
|
* Consume the next character of data in the stream.
|
||||||
*/
|
*/
|
||||||
consume: function() {
|
consume: function() {
|
||||||
|
//console.log("prev p="+ this.p +", c="+ this.data.charAt(this.p));
|
||||||
if ( this.p < this.n ) {
|
if ( this.p < this.n ) {
|
||||||
this.charPositionInLine++;
|
this.charPositionInLine++;
|
||||||
if ( this.data.charAt(this.p)==="\n" ) {
|
if ( this.data.charAt(this.p)==="\n" ) {
|
||||||
|
|
@ -3008,6 +3009,7 @@ org.antlr.runtime.ANTLRStringStream.prototype = {
|
||||||
this.charPositionInLine=0;
|
this.charPositionInLine=0;
|
||||||
}
|
}
|
||||||
this.p++;
|
this.p++;
|
||||||
|
//console.log("p moves to " + this.p + " (c='"+ this.data.charAt(this.p) +"')");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -4838,6 +4840,25 @@ org.antlr.runtime.BaseRecognizer.prototype = {
|
||||||
* @param {org.antlr.runtime.RecognitionException} e the error to be reported.
|
* @param {org.antlr.runtime.RecognitionException} e the error to be reported.
|
||||||
*/
|
*/
|
||||||
reportError: function(e) {
|
reportError: function(e) {
|
||||||
|
if(this.input.size() != 0) {
|
||||||
|
var token = this.input.get(e.index);
|
||||||
|
var errorMessage = "";
|
||||||
|
var column = 0;
|
||||||
|
var line = 0;
|
||||||
|
if(token.getType() == -1) {
|
||||||
|
token = this.input.get(this.input.size() - 1);
|
||||||
|
}
|
||||||
|
errorMessage = this.getErrorMessage(e, this.getTokenNames());
|
||||||
|
column = token.getStartIndex();
|
||||||
|
line = token.getLine() - 1;
|
||||||
|
|
||||||
|
var error = {
|
||||||
|
line: line,
|
||||||
|
message: errorMessage,
|
||||||
|
column: column
|
||||||
|
};
|
||||||
|
this.addError(error);
|
||||||
|
}
|
||||||
// if we've already reported an error and have not matched a token
|
// if we've already reported an error and have not matched a token
|
||||||
// yet successfully, don't report any errors.
|
// yet successfully, don't report any errors.
|
||||||
if ( this.state.errorRecovery ) {
|
if ( this.state.errorRecovery ) {
|
||||||
|
|
@ -4881,8 +4902,8 @@ org.antlr.runtime.BaseRecognizer.prototype = {
|
||||||
* @param {String} msg the error message to be displayed.
|
* @param {String} msg the error message to be displayed.
|
||||||
*/
|
*/
|
||||||
emitErrorMessage: function(msg) {
|
emitErrorMessage: function(msg) {
|
||||||
throw msg;
|
//throw msg;
|
||||||
//console.log(msg);
|
console.log(msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** What error message should be generated for the various
|
/** What error message should be generated for the various
|
||||||
|
|
@ -5567,11 +5588,11 @@ org.antlr.lang.extend(org.antlr.runtime.Lexer, org.antlr.runtime.BaseRecognizer,
|
||||||
return this.state.token;
|
return this.state.token;
|
||||||
}
|
}
|
||||||
catch (re) {
|
catch (re) {
|
||||||
if ( re instanceof org.antlr.runtime.RecognitionException ) {
|
if (re instanceof org.antlr.runtime.NoViableAltException) {
|
||||||
this.reportError(re);
|
|
||||||
} else if (re instanceof org.antlr.runtime.NoViableAltException) {
|
|
||||||
this.reportError(re);
|
this.reportError(re);
|
||||||
this.recover(re);
|
this.recover(re);
|
||||||
|
} else if ( re instanceof org.antlr.runtime.RecognitionException ) {
|
||||||
|
this.reportError(re);
|
||||||
} else {
|
} else {
|
||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,14 @@ define(function(require, exports, module) {
|
||||||
var XQueryLexer = require("./XQueryLexer").XQueryLexer;
|
var XQueryLexer = require("./XQueryLexer").XQueryLexer;
|
||||||
var XQueryParser = require("./XQueryParser").XQueryParser;
|
var XQueryParser = require("./XQueryParser").XQueryParser;
|
||||||
|
|
||||||
exports.parse = function(code) {
|
exports.getParser = function(code) {
|
||||||
var cstream = new org.antlr.runtime.ANTLRStringStream(code);
|
var cstream = new org.antlr.runtime.ANTLRStringStream(code);
|
||||||
var lexer = new XQueryLexer(cstream);
|
var lexer = new XQueryLexer(cstream);
|
||||||
var tstream = new NewLazyTokenStream(lexer);
|
var tstream = new NewLazyTokenStream(lexer);
|
||||||
tstream.jumpToFirstValidToken();
|
tstream.jumpToFirstValidToken();
|
||||||
var parser = new XQueryParser(tstream);
|
var parser = new XQueryParser(tstream);
|
||||||
parser.source = cstream;
|
parser.source = cstream;
|
||||||
parser.stream = tstream;
|
parser.stream = tstream;
|
||||||
parser.p_Module();
|
return parser;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -54,46 +54,26 @@ oop.inherits(XQueryWorker, Mirror);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
|
var parser = xquery.getParser(value);
|
||||||
try {
|
var ast = parser.p_Module();
|
||||||
xquery.parse(value);
|
if(parser.hasErrors()) {
|
||||||
} catch(e) {
|
var errors = parser.getErrors();
|
||||||
console.log(e);
|
var i = 0;
|
||||||
var m = e.match(/line (\d+):\-?(\d+) (.*)/);
|
for(i in errors) {
|
||||||
|
var error = errors[i];
|
||||||
if (m) {
|
this.sender.emit("error", {
|
||||||
var line = parseInt(m[1]) - 1;
|
row: error.line,
|
||||||
line = line <= 0 ? 0 : line;
|
column: error.column,
|
||||||
var col = parseInt(m[2]);
|
text: error.message,
|
||||||
console.log("Row: " + line);
|
type: "error"
|
||||||
console.log("Col: " + col);
|
});
|
||||||
this.sender.emit("error", {
|
}
|
||||||
row: line,
|
return;
|
||||||
column: col,
|
}
|
||||||
text: m[3],
|
this.sender.emit("ok");
|
||||||
type: "error"
|
};
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (e instanceof SyntaxError) {
|
|
||||||
var m = e.message.match(/ on line (\d+)/);
|
|
||||||
if (m) {
|
|
||||||
this.sender.emit("error", {
|
|
||||||
row: parseInt(m[1]) - 1,
|
|
||||||
column: null,
|
|
||||||
text: e.message.replace(m[0], ""),
|
|
||||||
type: "error"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.sender.emit("ok");
|
|
||||||
};
|
|
||||||
|
|
||||||
}).call(XQueryWorker.prototype);
|
}).call(XQueryWorker.prototype);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue