Add proof of concept for semantic highlighting.

This commit is contained in:
William Candillon 2012-04-13 15:55:49 +02:00
commit 0991f44263
18 changed files with 14295 additions and 13317 deletions

View file

@ -16,19 +16,18 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) { define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/mode/xquery_tokenizer', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
"use strict"; "use strict";
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer; var XQueryTokenizer = require("./xquery_tokenizer").XQueryTokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour; var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function(parent) { var Mode = function(parent) {
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules()); this.$tokenizer = new XQueryTokenizer();
this.$behaviour = new XQueryBehaviour(parent); this.$behaviour = new XQueryBehaviour(parent);
}; };
@ -110,6 +109,9 @@ oop.inherits(Mode, TextMode);
session.clearAnnotations(); session.clearAnnotations();
}); });
worker.on("highlight", function(tokens) {
session.getMode().$tokenizer.cache = tokens.data;
});
return worker; return worker;
}; };
@ -283,6 +285,69 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
exports.WorkerClient = WorkerClient; exports.WorkerClient = WorkerClient;
}); });
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define('ace/mode/xquery_tokenizer', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/xquery_highlight_rules'], function(require, exports, module) {
"use strict";
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryTokenizer = exports.XQueryTokenizer = function(){
this.cache = [];
this.$regexpTokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
};
(function() {
this.getLineTokens = function(line, startState) {
var cachedLine = null;
for(var i in this.cache)
{
var c = this.cache[i];
if(c && c.line == line && c.state == startState) {
console.log("RETURN CACHE");
return c.tokens;
}
}
return this.$regexpTokenizer.getLineTokens(line, startState);
};
}).call(XQueryTokenizer.prototype);
});
/* /*
* eXide - web-based XQuery IDE * eXide - web-based XQuery IDE
* *

File diff suppressed because it is too large Load diff

View file

@ -10,9 +10,8 @@
<!-- <!--
Ace Ace
version 0.2.0 version
commit 517e88f2f077263e49159c7b1742b5f3a7c605b4 commit
--> -->
</head> </head>

File diff suppressed because one or more lines are too long

View file

@ -16,19 +16,18 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
ace.define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) { ace.define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/mode/xquery_tokenizer', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
"use strict"; "use strict";
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer; var Tokenizer = require("./xquery_tokenizer").XQueryTokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour; var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function(parent) { var Mode = function(parent) {
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules()); this.$tokenizer = new XQueryTokenizer();
this.$behaviour = new XQueryBehaviour(parent); this.$behaviour = new XQueryBehaviour(parent);
}; };
@ -117,6 +116,59 @@ oop.inherits(Mode, TextMode);
exports.Mode = Mode; exports.Mode = Mode;
}); });
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
ace.define('ace/mode/xquery_tokenizer', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/xquery_highlight_rules'], function(require, exports, module) {
"use strict";
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryTokenizer = exports.XQueryTokenizer = function(){
this.$regexpTokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
};
(function() {
this.getLineTokens = function(line, startState) {
return this.$regexpTokenizer.getLineTokens(line, startState);
};
}).call(XQueryTokenizer.prototype);
});
/* /*
* eXide - web-based XQuery IDE * eXide - web-based XQuery IDE
* *

View file

@ -16,19 +16,18 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) { define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/mode/xquery_tokenizer', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
"use strict"; "use strict";
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer; var Tokenizer = require("./xquery_tokenizer").XQueryTokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour; var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function(parent) { var Mode = function(parent) {
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules()); this.$tokenizer = new XQueryTokenizer();
this.$behaviour = new XQueryBehaviour(parent); this.$behaviour = new XQueryBehaviour(parent);
}; };
@ -117,6 +116,59 @@ oop.inherits(Mode, TextMode);
exports.Mode = Mode; exports.Mode = Mode;
}); });
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define('ace/mode/xquery_tokenizer', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/xquery_highlight_rules'], function(require, exports, module) {
"use strict";
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryTokenizer = exports.XQueryTokenizer = function(){
this.$regexpTokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
};
(function() {
this.getLineTokens = function(line, startState) {
return this.$regexpTokenizer.getLineTokens(line, startState);
};
}).call(XQueryTokenizer.prototype);
});
/* /*
* eXide - web-based XQuery IDE * eXide - web-based XQuery IDE
* *

File diff suppressed because one or more lines are too long

View file

@ -22,13 +22,12 @@ define(function(require, exports, module) {
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer; var XQueryTokenizer = require("./xquery_tokenizer").XQueryTokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour; var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var Range = require("../range").Range; var Range = require("../range").Range;
var Mode = function(parent) { var Mode = function(parent) {
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules()); this.$tokenizer = new XQueryTokenizer();
this.$behaviour = new XQueryBehaviour(parent); this.$behaviour = new XQueryBehaviour(parent);
}; };
@ -110,6 +109,9 @@ oop.inherits(Mode, TextMode);
session.clearAnnotations(); session.clearAnnotations();
}); });
worker.on("highlight", function(tokens) {
session.getMode().$tokenizer.cache = tokens.data;
});
return worker; return worker;
}; };

View file

@ -0,0 +1,59 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module){
var Position = exports.Position = function(line, offset, length)
{
this.line = line;
this.offset = offset;
this.length = length;
this.getLine = function()
{
return this.line;
};
this.getOffset = function()
{
return this.offset;
};
this.getLength = function()
{
return this.length;
};
};
});

View file

@ -1,6 +1,41 @@
define(function(require, exports, module) { define(function(require, exports, module) {
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/StringLexer.g 2012-04-09 19:06:41 // $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/StringLexer.g 2012-04-13 15:32:18
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
var org = require("./antlr3-all").org; var org = require("./antlr3-all").org;
var XQDTLexer = require("./XQDTLexer").XQDTLexer; var XQDTLexer = require("./XQDTLexer").XQDTLexer;
@ -616,8 +651,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;
// xquery/StringLexer.g:31:6: ({...}? => '\"' ) // xquery/StringLexer.g:66:6: ({...}? => '\"' )
// xquery/StringLexer.g:31:8: {...}? => '\"' // xquery/StringLexer.g:66: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 ");
} }
@ -639,8 +674,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;
// xquery/StringLexer.g:32:6: ({...}? => '\\'' ) // xquery/StringLexer.g:67:6: ({...}? => '\\'' )
// xquery/StringLexer.g:32:8: {...}? => '\\'' // xquery/StringLexer.g:67: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 ");
} }
@ -662,8 +697,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;
// xquery/StringLexer.g:33:13: ({...}? => '\"\"' ) // xquery/StringLexer.g:68:13: ({...}? => '\"\"' )
// xquery/StringLexer.g:33:15: {...}? => '\"\"' // xquery/StringLexer.g:68: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 ");
} }
@ -685,8 +720,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;
// xquery/StringLexer.g:34:13: ({...}? => '\\'\\'' ) // xquery/StringLexer.g:69:13: ({...}? => '\\'\\'' )
// xquery/StringLexer.g:34:15: {...}? => '\\'\\'' // xquery/StringLexer.g:69: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 ");
} }
@ -708,13 +743,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;
// xquery/StringLexer.g:38:2: ({...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' ) // xquery/StringLexer.g:73:2: ({...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' )
// xquery/StringLexer.g:38:4: {...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' // xquery/StringLexer.g:73: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('&');
// xquery/StringLexer.g:38:48: ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) // xquery/StringLexer.g:73: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':
@ -751,35 +786,35 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
switch (alt1) { switch (alt1) {
case 1 : case 1 :
// xquery/StringLexer.g:38:49: 'lt' // xquery/StringLexer.g:73:49: 'lt'
this.match("lt"); this.match("lt");
break; break;
case 2 : case 2 :
// xquery/StringLexer.g:38:56: 'gt' // xquery/StringLexer.g:73:56: 'gt'
this.match("gt"); this.match("gt");
break; break;
case 3 : case 3 :
// xquery/StringLexer.g:38:63: 'apos' // xquery/StringLexer.g:73:63: 'apos'
this.match("apos"); this.match("apos");
break; break;
case 4 : case 4 :
// xquery/StringLexer.g:38:72: 'quot' // xquery/StringLexer.g:73:72: 'quot'
this.match("quot"); this.match("quot");
break; break;
case 5 : case 5 :
// xquery/StringLexer.g:38:81: 'amp' // xquery/StringLexer.g:73:81: 'amp'
this.match("amp"); this.match("amp");
@ -805,7 +840,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;
// xquery/StringLexer.g:43:2: ({...}? => '&#' ( '0' .. '9' )+ ';' | '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' ) // xquery/StringLexer.g:78: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);
@ -843,13 +878,13 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
} }
switch (alt4) { switch (alt4) {
case 1 : case 1 :
// xquery/StringLexer.g:43:4: {...}? => '&#' ( '0' .. '9' )+ ';' // xquery/StringLexer.g:78: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("&#");
// xquery/StringLexer.g:43:49: ( '0' .. '9' )+ // xquery/StringLexer.g:78:49: ( '0' .. '9' )+
var cnt2=0; var cnt2=0;
loop2: loop2:
do { do {
@ -863,7 +898,7 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
switch (alt2) { switch (alt2) {
case 1 : case 1 :
// xquery/StringLexer.g:43:49: '0' .. '9' // xquery/StringLexer.g:78:49: '0' .. '9'
this.matchRange('0','9'); this.matchRange('0','9');
@ -884,10 +919,10 @@ org.antlr.lang.augmentObject(StringLexer.prototype, {
break; break;
case 2 : case 2 :
// xquery/StringLexer.g:43:65: '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' // xquery/StringLexer.g:78:65: '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';'
this.match("&#x"); this.match("&#x");
// xquery/StringLexer.g:43:71: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ // xquery/StringLexer.g:78:71: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
var cnt3=0; var cnt3=0;
loop3: loop3:
do { do {
@ -944,12 +979,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;
// xquery/StringLexer.g:47:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ ) // xquery/StringLexer.g:82:2: ({...}? => ( '\\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' )+ // xquery/StringLexer.g:82: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 ");
} }
// xquery/StringLexer.g:48:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/StringLexer.g:83:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0027' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
var cnt5=0; var cnt5=0;
loop5: loop5:
do { do {
@ -1003,12 +1038,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;
// xquery/StringLexer.g:53:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ ) // xquery/StringLexer.g:88:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
// xquery/StringLexer.g:53:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/StringLexer.g:88: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 ");
} }
// xquery/StringLexer.g:54:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/StringLexer.g:89:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0028' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
var cnt6=0; var cnt6=0;
loop6: loop6:
do { do {
@ -1062,12 +1097,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;
// xquery/StringLexer.g:63:5: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ ) // xquery/StringLexer.g:98:5: ({...}? => ( '\\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' )+ // xquery/StringLexer.g:98: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 ");
} }
// xquery/StringLexer.g:64:9: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/StringLexer.g:99: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 {

View file

@ -1,6 +1,41 @@
define(function(require, exports, module) { define(function(require, exports, module) {
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/XMLLexer.g 2012-04-09 19:06:43 // $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/XMLLexer.g 2012-04-13 15:32:20
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
var org = require("./antlr3-all").org; var org = require("./antlr3-all").org;
var XQDTLexer = require("./XQDTLexer").XQDTLexer; var XQDTLexer = require("./XQDTLexer").XQDTLexer;
@ -668,8 +703,8 @@ org.antlr.lang.augmentObject(XMLLexer.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;
// xquery/XMLLexer.g:97:6: ({...}? => '\"' ) // xquery/XMLLexer.g:132:6: ({...}? => '\"' )
// xquery/XMLLexer.g:97:8: {...}? => '\"' // xquery/XMLLexer.g:132:8: {...}? => '\"'
if ( !(( this.inElem || this.inQuotAttr )) ) { if ( !(( this.inElem || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "QUOT", " this.inElem || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "QUOT", " this.inElem || this.inQuotAttr ");
} }
@ -691,8 +726,8 @@ org.antlr.lang.augmentObject(XMLLexer.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;
// xquery/XMLLexer.g:98:6: ({...}? => '\\'' ) // xquery/XMLLexer.g:133:6: ({...}? => '\\'' )
// xquery/XMLLexer.g:98:8: {...}? => '\\'' // xquery/XMLLexer.g:133:8: {...}? => '\\''
if ( !(( this.inElem || this.inAposAttr )) ) { if ( !(( this.inElem || this.inAposAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "APOS", " this.inElem || this.inAposAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "APOS", " this.inElem || this.inAposAttr ");
} }
@ -714,12 +749,12 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_QuotAttrContentChar; var _type = this.L_QuotAttrContentChar;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:101:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ ) // xquery/XMLLexer.g:136:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
// xquery/XMLLexer.g:101:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/XMLLexer.g:136:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
if ( !(( this.inQuotAttr )) ) { if ( !(( this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_QuotAttrContentChar", " this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_QuotAttrContentChar", " this.inQuotAttr ");
} }
// xquery/XMLLexer.g:102:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/XMLLexer.g:137:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
var cnt1=0; var cnt1=0;
loop1: loop1:
do { do {
@ -773,12 +808,12 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_AposAttrContentChar; var _type = this.L_AposAttrContentChar;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:108:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ ) // xquery/XMLLexer.g:143:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
// xquery/XMLLexer.g:108:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/XMLLexer.g:143:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
if ( !(( this.inAposAttr )) ) { if ( !(( this.inAposAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_AposAttrContentChar", " this.inAposAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_AposAttrContentChar", " this.inAposAttr ");
} }
// xquery/XMLLexer.g:109:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/XMLLexer.g:144:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' | '\\u0021' | '\\u0023' .. '\\u0025' | '\\u0028' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' .. '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
var cnt2=0; var cnt2=0;
loop2: loop2:
do { do {
@ -832,12 +867,12 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_ElementContentChar; var _type = this.L_ElementContentChar;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:116:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ ) // xquery/XMLLexer.g:151:2: ({...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ )
// xquery/XMLLexer.g:116:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/XMLLexer.g:151:4: {...}? => ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
if ( !(( !this.inElem )) ) { if ( !(( !this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_ElementContentChar", " !this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_ElementContentChar", " !this.inElem ");
} }
// xquery/XMLLexer.g:117:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+ // xquery/XMLLexer.g:152:3: ( '\\u0009' | '\\u000A' | '\\u000D' | '\\u0020' .. '\\u0025' | '\\u0027' .. '\\u003B' | '\\u003D' .. '\\u007A' | '\\u007C' | '\\u007E' .. '\\uD7FF' | '\\uE000' .. '\\uFFFD' )+
var cnt3=0; var cnt3=0;
loop3: loop3:
do { do {
@ -891,8 +926,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.GREATER; var _type = this.GREATER;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:123:2: ({...}? => '>' ) // xquery/XMLLexer.g:158:2: ({...}? => '>' )
// xquery/XMLLexer.g:123:4: {...}? => '>' // xquery/XMLLexer.g:158:4: {...}? => '>'
if ( !(( this.inElem )) ) { if ( !(( this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "GREATER", " this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "GREATER", " this.inElem ");
} }
@ -914,8 +949,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.EMPTY_CLOSE_TAG; var _type = this.EMPTY_CLOSE_TAG;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:127:2: ({...}? => '/>' ) // xquery/XMLLexer.g:162:2: ({...}? => '/>' )
// xquery/XMLLexer.g:127:4: {...}? => '/>' // xquery/XMLLexer.g:162:4: {...}? => '/>'
if ( !(( this.inElem )) ) { if ( !(( this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "EMPTY_CLOSE_TAG", " this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "EMPTY_CLOSE_TAG", " this.inElem ");
} }
@ -938,12 +973,12 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.S; var _type = this.S;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:131:2: ({...}? => ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // xquery/XMLLexer.g:166:2: ({...}? => ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// xquery/XMLLexer.g:131:4: {...}? => ( ' ' | '\\t' | '\\r' | '\\n' )+ // xquery/XMLLexer.g:166:4: {...}? => ( ' ' | '\\t' | '\\r' | '\\n' )+
if ( !(( this.inElem )) ) { if ( !(( this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "S", " this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "S", " this.inElem ");
} }
// xquery/XMLLexer.g:131:24: ( ' ' | '\\t' | '\\r' | '\\n' )+ // xquery/XMLLexer.g:166:24: ( ' ' | '\\t' | '\\r' | '\\n' )+
var cnt4=0; var cnt4=0;
loop4: loop4:
do { do {
@ -997,8 +1032,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_NCName; var _type = this.L_NCName;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:137:2: ({...}? => NCNameUnprotected ) // xquery/XMLLexer.g:172:2: ({...}? => NCNameUnprotected )
// xquery/XMLLexer.g:137:4: {...}? => NCNameUnprotected // xquery/XMLLexer.g:172:4: {...}? => NCNameUnprotected
if ( !(( this.inElem )) ) { if ( !(( this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_NCName", " this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_NCName", " this.inElem ");
} }
@ -1017,10 +1052,10 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
// $ANTLR start NCNameUnprotected // $ANTLR start NCNameUnprotected
mNCNameUnprotected: function() { mNCNameUnprotected: function() {
try { try {
// xquery/XMLLexer.g:141:2: ( NCNameStartChar ( NCNameChar )* ) // xquery/XMLLexer.g:176:2: ( NCNameStartChar ( NCNameChar )* )
// xquery/XMLLexer.g:141:4: NCNameStartChar ( NCNameChar )* // xquery/XMLLexer.g:176:4: NCNameStartChar ( NCNameChar )*
this.mNCNameStartChar(); this.mNCNameStartChar();
// xquery/XMLLexer.g:141:20: ( NCNameChar )* // xquery/XMLLexer.g:176:20: ( NCNameChar )*
loop5: loop5:
do { do {
var alt5=2; var alt5=2;
@ -1033,7 +1068,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
switch (alt5) { switch (alt5) {
case 1 : case 1 :
// xquery/XMLLexer.g:141:20: NCNameChar // xquery/XMLLexer.g:176:20: NCNameChar
this.mNCNameChar(); this.mNCNameChar();
@ -1056,7 +1091,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
// $ANTLR start NCNameStartChar // $ANTLR start NCNameStartChar
mNCNameStartChar: function() { mNCNameStartChar: function() {
try { try {
// xquery/XMLLexer.g:145:2: ( Letter | '_' ) // xquery/XMLLexer.g:180:2: ( Letter | '_' )
// xquery/XMLLexer.g: // xquery/XMLLexer.g:
if ( (this.input.LA(1)>='A' && this.input.LA(1)<='Z')||this.input.LA(1)=='_'||(this.input.LA(1)>='a' && this.input.LA(1)<='z') ) { if ( (this.input.LA(1)>='A' && this.input.LA(1)<='Z')||this.input.LA(1)=='_'||(this.input.LA(1)>='a' && this.input.LA(1)<='z') ) {
this.input.consume(); this.input.consume();
@ -1079,7 +1114,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
// $ANTLR start NCNameChar // $ANTLR start NCNameChar
mNCNameChar: function() { mNCNameChar: function() {
try { try {
// xquery/XMLLexer.g:149:2: ( Letter | XMLDigit | '.' | '-' | '_' ) // xquery/XMLLexer.g:184:2: ( Letter | XMLDigit | '.' | '-' | '_' )
// xquery/XMLLexer.g: // xquery/XMLLexer.g:
if ( (this.input.LA(1)>='-' && this.input.LA(1)<='.')||(this.input.LA(1)>='0' && this.input.LA(1)<='9')||(this.input.LA(1)>='A' && this.input.LA(1)<='Z')||this.input.LA(1)=='_'||(this.input.LA(1)>='a' && this.input.LA(1)<='z') ) { if ( (this.input.LA(1)>='-' && this.input.LA(1)<='.')||(this.input.LA(1)>='0' && this.input.LA(1)<='9')||(this.input.LA(1)>='A' && this.input.LA(1)<='Z')||this.input.LA(1)=='_'||(this.input.LA(1)>='a' && this.input.LA(1)<='z') ) {
this.input.consume(); this.input.consume();
@ -1102,7 +1137,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
// $ANTLR start Letter // $ANTLR start Letter
mLetter: function() { mLetter: function() {
try { try {
// xquery/XMLLexer.g:153:2: ( 'a' .. 'z' | 'A' .. 'Z' ) // xquery/XMLLexer.g:188:2: ( 'a' .. 'z' | 'A' .. 'Z' )
// xquery/XMLLexer.g: // xquery/XMLLexer.g:
if ( (this.input.LA(1)>='A' && this.input.LA(1)<='Z')||(this.input.LA(1)>='a' && this.input.LA(1)<='z') ) { if ( (this.input.LA(1)>='A' && this.input.LA(1)<='Z')||(this.input.LA(1)>='a' && this.input.LA(1)<='z') ) {
this.input.consume(); this.input.consume();
@ -1125,8 +1160,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
// $ANTLR start XMLDigit // $ANTLR start XMLDigit
mXMLDigit: function() { mXMLDigit: function() {
try { try {
// xquery/XMLLexer.g:157:2: ( '0' .. '9' ) // xquery/XMLLexer.g:192:2: ( '0' .. '9' )
// xquery/XMLLexer.g:157:4: '0' .. '9' // xquery/XMLLexer.g:192:4: '0' .. '9'
this.matchRange('0','9'); this.matchRange('0','9');
@ -1142,8 +1177,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.EQUAL; var _type = this.EQUAL;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:172:7: ({...}? => '=' ) // xquery/XMLLexer.g:207:7: ({...}? => '=' )
// xquery/XMLLexer.g:172:9: {...}? => '=' // xquery/XMLLexer.g:207:9: {...}? => '='
if ( !(( this.inElem )) ) { if ( !(( this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "EQUAL", " this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "EQUAL", " this.inElem ");
} }
@ -1164,8 +1199,8 @@ org.antlr.lang.augmentObject(XMLLexer.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;
// xquery/XMLLexer.g:173:13: ({...}? => '\\'\\'' ) // xquery/XMLLexer.g:208:13: ({...}? => '\\'\\'' )
// xquery/XMLLexer.g:173:15: {...}? => '\\'\\'' // xquery/XMLLexer.g:208:15: {...}? => '\\'\\''
if ( !(( this.inAposAttr )) ) { if ( !(( this.inAposAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_APOS", " this.inAposAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_APOS", " this.inAposAttr ");
} }
@ -1187,8 +1222,8 @@ org.antlr.lang.augmentObject(XMLLexer.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;
// xquery/XMLLexer.g:174:13: ({...}? => '\"\"' ) // xquery/XMLLexer.g:209:13: ({...}? => '\"\"' )
// xquery/XMLLexer.g:174:15: {...}? => '\"\"' // xquery/XMLLexer.g:209:15: {...}? => '\"\"'
if ( !(( this.inQuotAttr )) ) { if ( !(( this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_QUOT", " this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_QUOT", " this.inQuotAttr ");
} }
@ -1210,8 +1245,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.ESCAPE_LBRACKET; var _type = this.ESCAPE_LBRACKET;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:177:2: ({...}? => '{{' ) // xquery/XMLLexer.g:212:2: ({...}? => '{{' )
// xquery/XMLLexer.g:177:4: {...}? => '{{' // xquery/XMLLexer.g:212:4: {...}? => '{{'
if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) { if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_LBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_LBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr ");
} }
@ -1233,8 +1268,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.ESCAPE_RBRACKET; var _type = this.ESCAPE_RBRACKET;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:181:2: ({...}? => '}}' ) // xquery/XMLLexer.g:216:2: ({...}? => '}}' )
// xquery/XMLLexer.g:181:4: {...}? => '}}' // xquery/XMLLexer.g:216:4: {...}? => '}}'
if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) { if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_RBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "ESCAPE_RBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr ");
} }
@ -1256,8 +1291,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.LBRACKET; var _type = this.LBRACKET;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:184:10: ({...}? => '{' ) // xquery/XMLLexer.g:219:10: ({...}? => '{' )
// xquery/XMLLexer.g:184:12: {...}? => '{' // xquery/XMLLexer.g:219:12: {...}? => '{'
if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) { if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "LBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "LBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr ");
} }
@ -1278,8 +1313,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.RBRACKET; var _type = this.RBRACKET;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:185:10: ({...}? => '}' ) // xquery/XMLLexer.g:220:10: ({...}? => '}' )
// xquery/XMLLexer.g:185:12: {...}? => '}' // xquery/XMLLexer.g:220:12: {...}? => '}'
if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) { if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "RBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "RBRACKET", " !this.inElem || this.inAposAttr || this.inQuotAttr ");
} }
@ -1300,8 +1335,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.SMALLER; var _type = this.SMALLER;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:186:9: ( '<' ) // xquery/XMLLexer.g:221:9: ( '<' )
// xquery/XMLLexer.g:186:11: '<' // xquery/XMLLexer.g:221:11: '<'
this.match('<'); this.match('<');
@ -1319,8 +1354,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.CLOSE_TAG; var _type = this.CLOSE_TAG;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:187:11: ({...}? => '</' ) // xquery/XMLLexer.g:222:11: ({...}? => '</' )
// xquery/XMLLexer.g:187:13: {...}? => '</' // xquery/XMLLexer.g:222:13: {...}? => '</'
if ( !(( !this.inElem )) ) { if ( !(( !this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "CLOSE_TAG", " !this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "CLOSE_TAG", " !this.inElem ");
} }
@ -1343,8 +1378,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.CDATA_START; var _type = this.CDATA_START;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:189:13: ( '<![CDATA[' ) // xquery/XMLLexer.g:224:13: ( '<![CDATA[' )
// xquery/XMLLexer.g:189:15: '<![CDATA[' // xquery/XMLLexer.g:224:15: '<![CDATA['
this.match("<![CDATA["); this.match("<![CDATA[");
@ -1363,8 +1398,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.CDATA_END; var _type = this.CDATA_END;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:190:12: ( ']]>' ) // xquery/XMLLexer.g:225:12: ( ']]>' )
// xquery/XMLLexer.g:190:14: ']]>' // xquery/XMLLexer.g:225:14: ']]>'
this.match("]]>"); this.match("]]>");
@ -1383,15 +1418,15 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_CDataSection; var _type = this.L_CDataSection;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:194:3: ({...}? => CDATA_START ( options {greedy=false; } : ( . )* ) CDATA_END ) // xquery/XMLLexer.g:229:3: ({...}? => CDATA_START ( options {greedy=false; } : ( . )* ) CDATA_END )
// xquery/XMLLexer.g:194:5: {...}? => CDATA_START ( options {greedy=false; } : ( . )* ) CDATA_END // xquery/XMLLexer.g:229:5: {...}? => CDATA_START ( options {greedy=false; } : ( . )* ) CDATA_END
if ( !(( !this.inElem )) ) { if ( !(( !this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_CDataSection", " !this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_CDataSection", " !this.inElem ");
} }
this.mCDATA_START(); this.mCDATA_START();
// xquery/XMLLexer.g:194:38: ( options {greedy=false; } : ( . )* ) // xquery/XMLLexer.g:229:38: ( options {greedy=false; } : ( . )* )
// xquery/XMLLexer.g:194:65: ( . )* // xquery/XMLLexer.g:229:65: ( . )*
// xquery/XMLLexer.g:194:65: ( . )* // xquery/XMLLexer.g:229:65: ( . )*
loop6: loop6:
do { do {
var alt6=2; var alt6=2;
@ -1425,7 +1460,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
switch (alt6) { switch (alt6) {
case 1 : case 1 :
// xquery/XMLLexer.g:194:65: . // xquery/XMLLexer.g:229:65: .
this.matchAny(); this.matchAny();
@ -1456,13 +1491,13 @@ org.antlr.lang.augmentObject(XMLLexer.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;
// xquery/XMLLexer.g:202:2: ({...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' ) // xquery/XMLLexer.g:237:2: ({...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' )
// xquery/XMLLexer.g:202:4: {...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';' // xquery/XMLLexer.g:237:4: {...}? => '&' ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) ';'
if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) { if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_PredefinedEntityRef", " !this.inElem || this.inAposAttr || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_PredefinedEntityRef", " !this.inElem || this.inAposAttr || this.inQuotAttr ");
} }
this.match('&'); this.match('&');
// xquery/XMLLexer.g:202:67: ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' ) // xquery/XMLLexer.g:237:67: ( 'lt' | 'gt' | 'apos' | 'quot' | 'amp' )
var alt7=5; var alt7=5;
switch ( this.input.LA(1) ) { switch ( this.input.LA(1) ) {
case 'l': case 'l':
@ -1499,35 +1534,35 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
switch (alt7) { switch (alt7) {
case 1 : case 1 :
// xquery/XMLLexer.g:202:68: 'lt' // xquery/XMLLexer.g:237:68: 'lt'
this.match("lt"); this.match("lt");
break; break;
case 2 : case 2 :
// xquery/XMLLexer.g:202:75: 'gt' // xquery/XMLLexer.g:237:75: 'gt'
this.match("gt"); this.match("gt");
break; break;
case 3 : case 3 :
// xquery/XMLLexer.g:202:82: 'apos' // xquery/XMLLexer.g:237:82: 'apos'
this.match("apos"); this.match("apos");
break; break;
case 4 : case 4 :
// xquery/XMLLexer.g:202:91: 'quot' // xquery/XMLLexer.g:237:91: 'quot'
this.match("quot"); this.match("quot");
break; break;
case 5 : case 5 :
// xquery/XMLLexer.g:202:100: 'amp' // xquery/XMLLexer.g:237:100: 'amp'
this.match("amp"); this.match("amp");
@ -1553,7 +1588,7 @@ org.antlr.lang.augmentObject(XMLLexer.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;
// xquery/XMLLexer.g:207:2: ({...}? => '&#' ( '0' .. '9' )+ ';' | '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' ) // xquery/XMLLexer.g:242:2: ({...}? => '&#' ( '0' .. '9' )+ ';' | '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' )
var alt10=2; var alt10=2;
var LA10_0 = this.input.LA(1); var LA10_0 = this.input.LA(1);
@ -1591,13 +1626,13 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
} }
switch (alt10) { switch (alt10) {
case 1 : case 1 :
// xquery/XMLLexer.g:207:4: {...}? => '&#' ( '0' .. '9' )+ ';' // xquery/XMLLexer.g:242:4: {...}? => '&#' ( '0' .. '9' )+ ';'
if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) { if ( !(( !this.inElem || this.inAposAttr || this.inQuotAttr )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_CharRef", " !this.inElem || this.inAposAttr || this.inQuotAttr "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_CharRef", " !this.inElem || this.inAposAttr || this.inQuotAttr ");
} }
this.match("&#"); this.match("&#");
// xquery/XMLLexer.g:207:68: ( '0' .. '9' )+ // xquery/XMLLexer.g:242:68: ( '0' .. '9' )+
var cnt8=0; var cnt8=0;
loop8: loop8:
do { do {
@ -1611,7 +1646,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
switch (alt8) { switch (alt8) {
case 1 : case 1 :
// xquery/XMLLexer.g:207:69: '0' .. '9' // xquery/XMLLexer.g:242:69: '0' .. '9'
this.matchRange('0','9'); this.matchRange('0','9');
@ -1632,10 +1667,10 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
break; break;
case 2 : case 2 :
// xquery/XMLLexer.g:207:86: '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';' // xquery/XMLLexer.g:242:86: '&#x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ ';'
this.match("&#x"); this.match("&#x");
// xquery/XMLLexer.g:207:92: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ // xquery/XMLLexer.g:242:92: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
var cnt9=0; var cnt9=0;
loop9: loop9:
do { do {
@ -1692,16 +1727,16 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_DirCommentConstructor; var _type = this.L_DirCommentConstructor;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:211:2: ({...}? => '<!--' ( options {greedy=false; } : ( . )* ) '-->' ) // xquery/XMLLexer.g:246:2: ({...}? => '<!--' ( options {greedy=false; } : ( . )* ) '-->' )
// xquery/XMLLexer.g:211:4: {...}? => '<!--' ( options {greedy=false; } : ( . )* ) '-->' // xquery/XMLLexer.g:246:4: {...}? => '<!--' ( options {greedy=false; } : ( . )* ) '-->'
if ( !(( !this.inElem )) ) { if ( !(( !this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_DirCommentConstructor", " !this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_DirCommentConstructor", " !this.inElem ");
} }
this.match("<!--"); this.match("<!--");
// xquery/XMLLexer.g:211:32: ( options {greedy=false; } : ( . )* ) // xquery/XMLLexer.g:246:32: ( options {greedy=false; } : ( . )* )
// xquery/XMLLexer.g:211:59: ( . )* // xquery/XMLLexer.g:246:59: ( . )*
// xquery/XMLLexer.g:211:59: ( . )* // xquery/XMLLexer.g:246:59: ( . )*
loop11: loop11:
do { do {
var alt11=2; var alt11=2;
@ -1735,7 +1770,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
switch (alt11) { switch (alt11) {
case 1 : case 1 :
// xquery/XMLLexer.g:211:59: . // xquery/XMLLexer.g:246:59: .
this.matchAny(); this.matchAny();
@ -1767,14 +1802,14 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.L_DirPIConstructor; var _type = this.L_DirPIConstructor;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:214:2: ({...}? => '<?' ( SU )? NCNameUnprotected ( SU ( options {greedy=false; } : ( . )* ) )? '?>' ) // xquery/XMLLexer.g:249:2: ({...}? => '<?' ( SU )? NCNameUnprotected ( SU ( options {greedy=false; } : ( . )* ) )? '?>' )
// xquery/XMLLexer.g:214:4: {...}? => '<?' ( SU )? NCNameUnprotected ( SU ( options {greedy=false; } : ( . )* ) )? '?>' // xquery/XMLLexer.g:249:4: {...}? => '<?' ( SU )? NCNameUnprotected ( SU ( options {greedy=false; } : ( . )* ) )? '?>'
if ( !(( !this.inElem )) ) { if ( !(( !this.inElem )) ) {
throw new org.antlr.runtime.FailedPredicateException(this.input, "L_DirPIConstructor", " !this.inElem "); throw new org.antlr.runtime.FailedPredicateException(this.input, "L_DirPIConstructor", " !this.inElem ");
} }
this.match("<?"); this.match("<?");
// xquery/XMLLexer.g:215:8: ( SU )? // xquery/XMLLexer.g:250:8: ( SU )?
var alt12=2; var alt12=2;
var LA12_0 = this.input.LA(1); var LA12_0 = this.input.LA(1);
@ -1783,7 +1818,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
} }
switch (alt12) { switch (alt12) {
case 1 : case 1 :
// xquery/XMLLexer.g:215:8: SU // xquery/XMLLexer.g:250:8: SU
this.mSU(); this.mSU();
@ -1792,7 +1827,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
} }
this.mNCNameUnprotected(); this.mNCNameUnprotected();
// xquery/XMLLexer.g:215:30: ( SU ( options {greedy=false; } : ( . )* ) )? // xquery/XMLLexer.g:250:30: ( SU ( options {greedy=false; } : ( . )* ) )?
var alt14=2; var alt14=2;
var LA14_0 = this.input.LA(1); var LA14_0 = this.input.LA(1);
@ -1801,11 +1836,11 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
} }
switch (alt14) { switch (alt14) {
case 1 : case 1 :
// xquery/XMLLexer.g:215:31: SU ( options {greedy=false; } : ( . )* ) // xquery/XMLLexer.g:250:31: SU ( options {greedy=false; } : ( . )* )
this.mSU(); this.mSU();
// xquery/XMLLexer.g:215:34: ( options {greedy=false; } : ( . )* ) // xquery/XMLLexer.g:250:34: ( options {greedy=false; } : ( . )* )
// xquery/XMLLexer.g:215:61: ( . )* // xquery/XMLLexer.g:250:61: ( . )*
// xquery/XMLLexer.g:215:61: ( . )* // xquery/XMLLexer.g:250:61: ( . )*
loop13: loop13:
do { do {
var alt13=2; var alt13=2;
@ -1830,7 +1865,7 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
switch (alt13) { switch (alt13) {
case 1 : case 1 :
// xquery/XMLLexer.g:215:61: . // xquery/XMLLexer.g:250:61: .
this.matchAny(); this.matchAny();
@ -1866,9 +1901,9 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
// $ANTLR start SU // $ANTLR start SU
mSU: function() { mSU: function() {
try { try {
// xquery/XMLLexer.g:219:2: ( ( ' ' | '\\t' | '\\n' | '\\r' )+ ) // xquery/XMLLexer.g:254:2: ( ( ' ' | '\\t' | '\\n' | '\\r' )+ )
// xquery/XMLLexer.g:219:4: ( ' ' | '\\t' | '\\n' | '\\r' )+ // xquery/XMLLexer.g:254:4: ( ' ' | '\\t' | '\\n' | '\\r' )+
// xquery/XMLLexer.g:219:4: ( ' ' | '\\t' | '\\n' | '\\r' )+ // xquery/XMLLexer.g:254:4: ( ' ' | '\\t' | '\\n' | '\\r' )+
var cnt15=0; var cnt15=0;
loop15: loop15:
do { do {
@ -1920,8 +1955,8 @@ org.antlr.lang.augmentObject(XMLLexer.prototype, {
try { try {
var _type = this.COLON; var _type = this.COLON;
var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL; var _channel = org.antlr.runtime.BaseRecognizer.DEFAULT_TOKEN_CHANNEL;
// xquery/XMLLexer.g:222:7: ( ':' ) // xquery/XMLLexer.g:257:7: ( ':' )
// xquery/XMLLexer.g:222:9: ':' // xquery/XMLLexer.g:257:9: ':'
this.match(':'); this.match(':');

View file

@ -1,3 +1,38 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module){ define(function(require, exports, module){
var org = require("./antlr3-all").org; var org = require("./antlr3-all").org;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,103 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module){
var Position = require("./Position").Position;
var XQuerySemanticHighlighter = exports.XQuerySemanticHighlighter = function() {
this.source = [];
this.lines = [];
this.getTokens = function() {
var result = [];
var previousState = "start";
for(i in this.source){
var lineTokens = [];
var tokens = [];
if(this.lines[i]) {
tokens = this.lines[i].sort(function(a, b){ return a.position.getOffset() - b.position.getOffset(); });
}
var sourceLine = this.source[i];
var cursor = 0;
for(j in tokens)
{
var token = tokens[j];
var position = token.position;
if(position.getOffset() > cursor) {
lineTokens.push({
type: "text",
value: sourceLine.substring(cursor, position.getOffset())
});
}
cursor = position.getOffset() + position.getLength();
lineTokens.push({
type: token.type,
value: sourceLine.substring(position.getOffset(), cursor)
});
}
if(cursor < (sourceLine.length - 1)) {
lineTokens.push({
type: "text",
value: sourceLine.substring(cursor)
});
}
result[i] = { line: sourceLine, state: previousState, tokens: { tokens: lineTokens, state: "start" } };
}
return result;
};
this.addToken = function(token, type) {
var line = token.getLine() - 1;
var offset = token.getCharPositionInLine();
var length = token.getStopIndex() - token.getStartIndex() + 1;
var position = new Position(line, offset, length);
if(!this.lines[line]) {
this.lines[line] = [];
}
this.lines[line].push({
type: type,
position: position
});
};
this.setSource = function(source)
{
this.source = source.data.split("\n");
};
//console.log("Line: " + token.getLine());
//console.log(token.getText());
//console.log(type);
};
});

View file

@ -49,8 +49,10 @@ define(function(require, exports, module) {
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.setSource(cstream);
//parser.setTokenStream(tstream);
return parser; return parser;
}; };
}); });

View file

@ -0,0 +1,63 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Candillon <wcandillon AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryTokenizer = exports.XQueryTokenizer = function(){
this.cache = [];
this.$regexpTokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
};
(function() {
this.getLineTokens = function(line, startState) {
var cachedLine = null;
for(var i in this.cache)
{
var c = this.cache[i];
if(c && c.line == line && c.state == startState) {
console.log("RETURN CACHE");
return c.tokens;
}
}
return this.$regexpTokenizer.getLineTokens(line, startState);
};
}).call(XQueryTokenizer.prototype);
});

View file

@ -70,8 +70,12 @@ oop.inherits(XQueryWorker, Mirror);
type: "error" type: "error"
}); });
} }
var tokens = parser.highlighter.getTokens();
this.sender.emit("highlight", tokens);
return; return;
} }
var tokens = parser.highlighter.getTokens();
this.sender.emit("highlight", tokens);
this.sender.emit("ok"); this.sender.emit("ok");
}; };