2715 lines
322 KiB
JavaScript
2715 lines
322 KiB
JavaScript
|
/* ***** BEGIN LICENSE BLOCK *****
|
||
|
* Distributed under the BSD license:
|
||
|
*
|
||
|
* Copyright (c) 2010, Ajax.org B.V.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* Redistribution and use in source and binary forms, with or without
|
||
|
* modification, are permitted provided that the following conditions are met:
|
||
|
* * Redistributions of source code must retain the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer.
|
||
|
* * Redistributions in binary form must reproduce the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer in the
|
||
|
* documentation and/or other materials provided with the distribution.
|
||
|
* * Neither the name of Ajax.org B.V. nor the
|
||
|
* names of its contributors may be used to endorse or promote products
|
||
|
* derived from this software without specific prior written permission.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*
|
||
|
* ***** END LICENSE BLOCK ***** */
|
||
|
ace.define('ace/mode/jsoniq', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/xquery/JSONiqLexer', 'ace/range', 'ace/mode/behaviour/xquery', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||
|
|
||
|
|
||
|
var oop = require("../lib/oop");
|
||
|
var TextMode = require("./text").Mode;
|
||
|
var JSONiqLexer = require("./xquery/JSONiqLexer").JSONiqLexer;
|
||
|
var Range = require("../range").Range;
|
||
|
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
|
||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||
|
|
||
|
|
||
|
var Mode = function() {
|
||
|
this.$tokenizer = new JSONiqLexer();
|
||
|
this.$behaviour = new XQueryBehaviour();
|
||
|
this.foldingRules = new CStyleFoldMode();
|
||
|
};
|
||
|
|
||
|
oop.inherits(Mode, TextMode);
|
||
|
|
||
|
(function() {
|
||
|
|
||
|
this.getNextLineIndent = function(state, line, tab) {
|
||
|
var indent = this.$getIndent(line);
|
||
|
var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
|
||
|
if (match)
|
||
|
indent += tab;
|
||
|
return indent;
|
||
|
};
|
||
|
|
||
|
this.checkOutdent = function(state, line, input) {
|
||
|
if (! /^\s+$/.test(line))
|
||
|
return false;
|
||
|
|
||
|
return /^\s*[\}\)]/.test(input);
|
||
|
};
|
||
|
|
||
|
this.autoOutdent = function(state, doc, row) {
|
||
|
var line = doc.getLine(row);
|
||
|
var match = line.match(/^(\s*[\}\)])/);
|
||
|
|
||
|
if (!match) return 0;
|
||
|
|
||
|
var column = match[1].length;
|
||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||
|
|
||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||
|
|
||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||
|
};
|
||
|
|
||
|
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||
|
var i, line;
|
||
|
var outdent = true;
|
||
|
var re = /^\s*\(:(.*):\)/;
|
||
|
|
||
|
for (i=startRow; i<= endRow; i++) {
|
||
|
if (!re.test(doc.getLine(i))) {
|
||
|
outdent = false;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var range = new Range(0, 0, 0, 0);
|
||
|
for (i=startRow; i<= endRow; i++) {
|
||
|
line = doc.getLine(i);
|
||
|
range.start.row = i;
|
||
|
range.end.row = i;
|
||
|
range.end.column = line.length;
|
||
|
|
||
|
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
||
|
}
|
||
|
};
|
||
|
}).call(Mode.prototype);
|
||
|
|
||
|
exports.Mode = Mode;
|
||
|
});
|
||
|
|
||
|
ace.define('ace/mode/xquery/JSONiqLexer', ['require', 'exports', 'module' , 'ace/mode/xquery/JSONiqTokenizer'], function(require, exports, module) {
|
||
|
|
||
|
var JSONiqTokenizer = require("./JSONiqTokenizer").JSONiqTokenizer;
|
||
|
|
||
|
var TokenHandler = function(code) {
|
||
|
|
||
|
var input = code;
|
||
|
|
||
|
this.tokens = [];
|
||
|
|
||
|
this.reset = function(code) {
|
||
|
input = input;
|
||
|
this.tokens = [];
|
||
|
};
|
||
|
|
||
|
this.startNonterminal = function(name, begin) {};
|
||
|
|
||
|
this.endNonterminal = function(name, end) {};
|
||
|
|
||
|
this.terminal = function(name, begin, end) {
|
||
|
this.tokens.push({
|
||
|
name: name,
|
||
|
value: input.substring(begin, end)
|
||
|
});
|
||
|
};
|
||
|
|
||
|
this.whitespace = function(begin, end) {
|
||
|
this.tokens.push({
|
||
|
name: "WS",
|
||
|
value: input.substring(begin, end)
|
||
|
});
|
||
|
};
|
||
|
};
|
||
|
var keys = "NaN|after|allowing|ancestor|ancestor-or-self|and|append|array|as|ascending|at|attribute|base-uri|before|boundary-space|break|by|case|cast|castable|catch|child|collation|comment|constraint|construction|contains|context|continue|copy|copy-namespaces|count|decimal-format|decimal-separator|declare|default|delete|descendant|descendant-or-self|descending|digit|div|document|document-node|element|else|empty|empty-sequence|encoding|end|eq|every|except|exit|external|false|first|following|following-sibling|for|from|ft-option|function|ge|greatest|group|grouping-separator|gt|idiv|if|import|in|index|infinity|insert|instance|integrity|intersect|into|is|item|json|json-item|jsoniq|last|lax|le|least|let|loop|lt|minus-sign|mod|modify|module|namespace|namespace-node|ne|next|node|nodes|not|null|object|of|only|option|or|order|ordered|ordering|paragraphs|parent|pattern-separator|per-mille|percent|preceding|preceding-sibling|previous|processing-instruction|rename|replace|return|returning|revalidation|satisfies|schema|schema-attribute|schema-element|score|select|self|sentences|sliding|some|stable|start|strict|switch|text|then|times|to|treat|true|try|tumbling|type|typeswitch|union|unordered|updating|validate|value|variable|version|when|where|while|window|with|words|xquery|zero-digit".split("|");
|
||
|
var keywords = keys.map(
|
||
|
function(val) { return { name: "'" + val + "'", token: "keyword" }; }
|
||
|
);
|
||
|
|
||
|
var ncnames = keys.map(
|
||
|
function(val) { return { name: "'" + val + "'", token: "text", next: function(stack){ stack.pop(); } }; }
|
||
|
);
|
||
|
|
||
|
var cdata = "constant.language";
|
||
|
var number = "constant";
|
||
|
var xmlcomment = "comment";
|
||
|
var pi = "xml-pe";
|
||
|
var pragma = "constant.buildin";
|
||
|
|
||
|
var Rules = {
|
||
|
start: [
|
||
|
{ name: "'(#'", token: pragma, next: function(stack){ stack.push("Pragma"); } },
|
||
|
{ name: "'(:'", token: "comment", next: function(stack){ stack.push("Comment"); } },
|
||
|
{ name: "'(:~'", token: "comment.doc", next: function(stack){ stack.push("CommentDoc"); } },
|
||
|
{ name: "'<!--'", token: xmlcomment, next: function(stack){ stack.push("XMLComment"); } },
|
||
|
{ name: "'<?'", token: pi, next: function(stack) { stack.push("PI"); } },
|
||
|
{ name: "''''", token: "string", next: function(stack){ stack.push("AposString"); } },
|
||
|
{ name: "'\"'", token: "string", next: function(stack){ stack.push("QuotString"); } },
|
||
|
{ name: "Annotation", token: "support.function" },
|
||
|
{ name: "ModuleDecl", token: "keyword", next: function(stack){ stack.push("Prefix"); } },
|
||
|
{ name: "OptionDecl", token: "keyword", next: function(stack){ stack.push("_EQName"); } },
|
||
|
{ name: "AttrTest", token: "support.type" },
|
||
|
{ name: "Variable", token: "variable" },
|
||
|
{ name: "'<![CDATA['", token: cdata, next: function(stack){ stack.push("CData"); } },
|
||
|
{ name: "IntegerLiteral", token: number },
|
||
|
{ name: "DecimalLiteral", token: number },
|
||
|
{ name: "DoubleLiteral", token: number },
|
||
|
{ name: "Operator", token: "keyword.operator" },
|
||
|
{ name: "EQName", token: function(val) { return keys.indexOf(val) !== -1 ? "keyword" : "support.function"; } },
|
||
|
{ name: "'('", token:"lparen" },
|
||
|
{ name: "')'", token:"rparen" },
|
||
|
{ name: "Tag", token: "meta.tag", next: function(stack){ stack.push("StartTag"); } },
|
||
|
{ name: "'}'", token: "text", next: function(stack){ if(stack.length > 1) stack.pop(); } },
|
||
|
{ name: "'{'", token: "text", next: function(stack){ stack.push("start"); } } //, next: function(stack){ if(stack.length > 1) { stack.pop(); } } }
|
||
|
].concat(keywords),
|
||
|
_EQName: [
|
||
|
{ name: "EQName", token: "text", next: function(stack) { stack.pop(); } }
|
||
|
].concat(ncnames),
|
||
|
Prefix: [
|
||
|
{ name: "NCName", token: "text", next: function(stack) { stack.pop(); } }
|
||
|
].concat(ncnames),
|
||
|
StartTag: [
|
||
|
{ name: "'>'", token: "meta.tag", next: function(stack){ stack.push("TagContent"); } },
|
||
|
{ name: "QName", token: "entity.other.attribute-name" },
|
||
|
{ name: "'='", token: "text" },
|
||
|
{ name: "''''", token: "string", next: function(stack){ stack.push("AposAttr"); } },
|
||
|
{ name: "'\"'", token: "string", next: function(stack){ stack.push("QuotAttr"); } },
|
||
|
{ name: "'/>'", token: "meta.tag.r", next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
TagContent: [
|
||
|
{ name: "ElementContentChar", token: "text" },
|
||
|
{ name: "'<![CDATA['", token: cdata, next: function(stack){ stack.push("CData"); } },
|
||
|
{ name: "'<!--'", token: xmlcomment, next: function(stack){ stack.push("XMLComment"); } },
|
||
|
{ name: "Tag", token: "meta.tag", next: function(stack){ stack.push("StartTag"); } },
|
||
|
{ name: "PredefinedEntityRef", token: "constant.language.escape" },
|
||
|
{ name: "CharRef", token: "constant.language.escape" },
|
||
|
{ name: "'{{'", token: "text" },
|
||
|
{ name: "'}}'", token: "text" },
|
||
|
{ name: "'{'", token: "text", next: function(stack){ stack.push("start"); } },
|
||
|
{ name: "EndTag", token: "meta.tag", next: function(stack){ stack.pop(); stack.pop(); } }
|
||
|
],
|
||
|
AposAttr: [
|
||
|
{ name: "''''", token: "string", next: function(stack){ stack.pop(); } },
|
||
|
{ name: "EscapeApos", token: "constant.language.escape" },
|
||
|
{ name: "AposAttrContentChar", token: "string" },
|
||
|
{ name: "PredefinedEntityRef", token: "constant.language.escape" },
|
||
|
{ name: "CharRef", token: "constant.language.escape" },
|
||
|
{ name: "'{{'", token: "string" },
|
||
|
{ name: "'}}'", token: "string" },
|
||
|
{ name: "'{'", token: "text", next: function(stack){ stack.push("start"); } }
|
||
|
],
|
||
|
QuotAttr: [
|
||
|
{ name: "'\"'", token: "string", next: function(stack){ stack.pop(); } },
|
||
|
{ name: "EscapeQuot", token: "constant.language.escape" },
|
||
|
{ name: "QuotAttrContentChar", token: "string" },
|
||
|
{ name: "PredefinedEntityRef", token: "constant.language.escape" },
|
||
|
{ name: "CharRef", token: "constant.language.escape" },
|
||
|
{ name: "'{{'", token: "string" },
|
||
|
{ name: "'}}'", token: "string" },
|
||
|
{ name: "'{'", token: "text", next: function(stack){ stack.push("start"); } }
|
||
|
],
|
||
|
Pragma: [
|
||
|
{ name: "PragmaContents", token: pragma },
|
||
|
{ name: "'#'", token: pragma },
|
||
|
{ name: "'#)'", token: pragma, next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
Comment: [
|
||
|
{ name: "CommentContents", token: "comment" },
|
||
|
{ name: "'(:'", token: "comment", next: function(stack){ stack.push("Comment"); } },
|
||
|
{ name: "':)'", token: "comment", next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
CommentDoc: [
|
||
|
{ name: "DocCommentContents", token: "comment.doc" },
|
||
|
{ name: "DocTag", token: "comment.doc.tag" },
|
||
|
{ name: "'(:'", token: "comment.doc", next: function(stack){ stack.push("CommentDoc"); } },
|
||
|
{ name: "':)'", token: "comment.doc", next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
XMLComment: [
|
||
|
{ name: "DirCommentContents", token: xmlcomment },
|
||
|
{ name: "'-->'", token: xmlcomment, next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
CData: [
|
||
|
{ name: "CDataSectionContents", token: cdata },
|
||
|
{ name: "']]>'", token: cdata, next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
PI: [
|
||
|
{ name: "DirPIContents", token: pi },
|
||
|
{ name: "'?'", token: pi },
|
||
|
{ name: "'?>'", token: pi, next: function(stack){ stack.pop(); } }
|
||
|
],
|
||
|
AposString: [
|
||
|
{ name: "''''", token: "string", next: function(stack){ stack.pop(); } },
|
||
|
{ name: "PredefinedEntityRef", token: "constant.language.escape" },
|
||
|
{ name: "CharRef", token: "constant.language.escape" },
|
||
|
{ name: "EscapeApos", token: "constant.language.escape" },
|
||
|
{ name: "AposChar", token: "string" }
|
||
|
],
|
||
|
QuotString: [
|
||
|
{ name: "'\"'", token: "string", next: function(stack){ stack.pop(); } },
|
||
|
{ name: "PredefinedEntityRef", token: "constant.language.escape" },
|
||
|
{ name: "CharRef", token: "constant.language.escape" },
|
||
|
{ name: "EscapeQuot", token: "constant.language.escape" },
|
||
|
{ name: "QuotChar", token: "string" }
|
||
|
]
|
||
|
};
|
||
|
|
||
|
exports.JSONiqLexer = function() {
|
||
|
|
||
|
this.tokens = [];
|
||
|
|
||
|
this.getLineTokens = function(line, state, row) {
|
||
|
state = (state === "start" || !state) ? '["start"]' : state;
|
||
|
var stack = JSON.parse(state);
|
||
|
var h = new TokenHandler(line);
|
||
|
var tokenizer = new JSONiqTokenizer(line, h);
|
||
|
var tokens = [];
|
||
|
|
||
|
while(true) {
|
||
|
var currentState = stack[stack.length - 1];
|
||
|
try {
|
||
|
|
||
|
h.tokens = [];
|
||
|
tokenizer["parse_" + currentState]();
|
||
|
var info = null;
|
||
|
|
||
|
if(h.tokens.length > 1 && h.tokens[0].name === "WS") {
|
||
|
tokens.push({
|
||
|
type: "text",
|
||
|
value: h.tokens[0].value
|
||
|
});
|
||
|
h.tokens.splice(0, 1);
|
||
|
}
|
||
|
|
||
|
var token = h.tokens[0];
|
||
|
var rules = Rules[currentState];
|
||
|
for(var k = 0; k < rules.length; k++) {
|
||
|
var rule = Rules[currentState][k];
|
||
|
if((typeof(rule.name) === "function" && rule.name(token)) || rule.name === token.name) {
|
||
|
info = rule;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(token.name === "EOF") { break; }
|
||
|
if(token.value === "") { throw "Encountered empty string lexical rule."; }
|
||
|
|
||
|
tokens.push({
|
||
|
type: info === null ? "text" : (typeof(info.token) === "function" ? info.token(token.value) : info.token),
|
||
|
value: token.value
|
||
|
});
|
||
|
|
||
|
if(info && info.next) {
|
||
|
info.next(stack);
|
||
|
}
|
||
|
|
||
|
} catch(e) {
|
||
|
if(e instanceof tokenizer.ParseException) {
|
||
|
var index = 0;
|
||
|
for(var i=0; i < tokens.length; i++) {
|
||
|
index += tokens[i].value.length;
|
||
|
}
|
||
|
tokens.push({ type: "text", value: line.substring(index) });
|
||
|
return {
|
||
|
tokens: tokens,
|
||
|
state: JSON.stringify(["start"])
|
||
|
};
|
||
|
} else {
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
if(this.tokens[row] !== undefined) {
|
||
|
var cachedLine = this.lines[row];
|
||
|
var begin = sharedStart([line, cachedLine]);
|
||
|
var diff = cachedLine.length - line.length;
|
||
|
var idx = 0;
|
||
|
var col = 0;
|
||
|
for(var i = 0; i < tokens.length; i++) {
|
||
|
var token = tokens[i];
|
||
|
for(var j = 0; j < this.tokens[row].length; j++) {
|
||
|
var semanticToken = this.tokens[row][j];
|
||
|
if(
|
||
|
((col + token.value.length) <= begin.length && semanticToken.sc === col && semanticToken.ec === (col + token.value.length)) ||
|
||
|
(semanticToken.sc === (col + diff) && semanticToken.ec === (col + token.value.length + diff))
|
||
|
) {
|
||
|
idx = i;
|
||
|
tokens[i].type = semanticToken.type;
|
||
|
}
|
||
|
}
|
||
|
col += token.value.length;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
tokens: tokens,
|
||
|
state: JSON.stringify(stack)
|
||
|
};
|
||
|
};
|
||
|
|
||
|
function sharedStart(A) {
|
||
|
var tem1, tem2, s, A = A.slice(0).sort();
|
||
|
tem1 = A[0];
|
||
|
s = tem1.length;
|
||
|
tem2 = A.pop();
|
||
|
while(s && tem2.indexOf(tem1) == -1) {
|
||
|
tem1 = tem1.substring(0, --s);
|
||
|
}
|
||
|
return tem1;
|
||
|
}
|
||
|
};
|
||
|
});
|
||
|
|
||
|
ace.define('ace/mode/xquery/JSONiqTokenizer', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||
|
var JSONiqTokenizer = exports.JSONiqTokenizer = function JSONiqTokenizer(string, parsingEventHandler)
|
||
|
{
|
||
|
init(string, parsingEventHandler);
|
||
|
var self = this;
|
||
|
|
||
|
this.ParseException = function(b, e, s, o, x)
|
||
|
{
|
||
|
var
|
||
|
begin = b,
|
||
|
end = e,
|
||
|
state = s,
|
||
|
offending = o,
|
||
|
expected = x;
|
||
|
|
||
|
this.getBegin = function() {return begin;};
|
||
|
this.getEnd = function() {return end;};
|
||
|
this.getState = function() {return state;};
|
||
|
this.getExpected = function() {return expected;};
|
||
|
this.getOffending = function() {return offending;};
|
||
|
|
||
|
this.getMessage = function()
|
||
|
{
|
||
|
return offending < 0 ? "lexical analysis failed" : "syntax error";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
function init(string, parsingEventHandler)
|
||
|
{
|
||
|
eventHandler = parsingEventHandler;
|
||
|
input = string;
|
||
|
size = string.length;
|
||
|
reset(0, 0, 0);
|
||
|
}
|
||
|
|
||
|
this.getInput = function()
|
||
|
{
|
||
|
return input;
|
||
|
};
|
||
|
|
||
|
function reset(l, b, e)
|
||
|
{
|
||
|
b0 = b; e0 = b;
|
||
|
l1 = l; b1 = b; e1 = e;
|
||
|
end = e;
|
||
|
eventHandler.reset(input);
|
||
|
}
|
||
|
|
||
|
this.getOffendingToken = function(e)
|
||
|
{
|
||
|
var o = e.getOffending();
|
||
|
return o >= 0 ? JSONiqTokenizer.TOKEN[o] : null;
|
||
|
};
|
||
|
|
||
|
this.getExpectedTokenSet = function(e)
|
||
|
{
|
||
|
var expected;
|
||
|
if (e.getExpected() < 0)
|
||
|
{
|
||
|
expected = JSONiqTokenizer.getTokenSet(- e.getState());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
expected = [JSONiqTokenizer.TOKEN[e.getExpected()]];
|
||
|
}
|
||
|
return expected;
|
||
|
};
|
||
|
|
||
|
this.getErrorMessage = function(e)
|
||
|
{
|
||
|
var tokenSet = this.getExpectedTokenSet(e);
|
||
|
var found = this.getOffendingToken(e);
|
||
|
var prefix = input.substring(0, e.getBegin());
|
||
|
var lines = prefix.split("\n");
|
||
|
var line = lines.length;
|
||
|
var column = lines[line - 1].length + 1;
|
||
|
var size = e.getEnd() - e.getBegin();
|
||
|
return e.getMessage()
|
||
|
+ (found == null ? "" : ", found " + found)
|
||
|
+ "\nwhile expecting "
|
||
|
+ (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]"))
|
||
|
+ "\n"
|
||
|
+ (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ")
|
||
|
+ "at line " + line + ", column " + column + ":\n..."
|
||
|
+ input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64))
|
||
|
+ "...";
|
||
|
};
|
||
|
|
||
|
this.parse_start = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("start", e0);
|
||
|
lookahead1W(14); // ModuleDecl | Annotation | OptionDecl | Operator | Variable | Tag | AttrTest |
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 55: // '<![CDATA['
|
||
|
shift(55); // '<![CDATA['
|
||
|
break;
|
||
|
case 54: // '<!--'
|
||
|
shift(54); // '<!--'
|
||
|
break;
|
||
|
case 56: // '<?'
|
||
|
shift(56); // '<?'
|
||
|
break;
|
||
|
case 40: // '(#'
|
||
|
shift(40); // '(#'
|
||
|
break;
|
||
|
case 42: // '(:~'
|
||
|
shift(42); // '(:~'
|
||
|
break;
|
||
|
case 41: // '(:'
|
||
|
shift(41); // '(:'
|
||
|
break;
|
||
|
case 35: // '"'
|
||
|
shift(35); // '"'
|
||
|
break;
|
||
|
case 38: // "'"
|
||
|
shift(38); // "'"
|
||
|
break;
|
||
|
case 274: // '}'
|
||
|
shift(274); // '}'
|
||
|
break;
|
||
|
case 271: // '{'
|
||
|
shift(271); // '{'
|
||
|
break;
|
||
|
case 39: // '('
|
||
|
shift(39); // '('
|
||
|
break;
|
||
|
case 43: // ')'
|
||
|
shift(43); // ')'
|
||
|
break;
|
||
|
case 49: // '/'
|
||
|
shift(49); // '/'
|
||
|
break;
|
||
|
case 62: // '['
|
||
|
shift(62); // '['
|
||
|
break;
|
||
|
case 63: // ']'
|
||
|
shift(63); // ']'
|
||
|
break;
|
||
|
case 46: // ','
|
||
|
shift(46); // ','
|
||
|
break;
|
||
|
case 48: // '.'
|
||
|
shift(48); // '.'
|
||
|
break;
|
||
|
case 53: // ';'
|
||
|
shift(53); // ';'
|
||
|
break;
|
||
|
case 51: // ':'
|
||
|
shift(51); // ':'
|
||
|
break;
|
||
|
case 34: // '!'
|
||
|
shift(34); // '!'
|
||
|
break;
|
||
|
case 273: // '|'
|
||
|
shift(273); // '|'
|
||
|
break;
|
||
|
case 2: // Annotation
|
||
|
shift(2); // Annotation
|
||
|
break;
|
||
|
case 1: // ModuleDecl
|
||
|
shift(1); // ModuleDecl
|
||
|
break;
|
||
|
case 3: // OptionDecl
|
||
|
shift(3); // OptionDecl
|
||
|
break;
|
||
|
case 12: // AttrTest
|
||
|
shift(12); // AttrTest
|
||
|
break;
|
||
|
case 13: // Wildcard
|
||
|
shift(13); // Wildcard
|
||
|
break;
|
||
|
case 15: // IntegerLiteral
|
||
|
shift(15); // IntegerLiteral
|
||
|
break;
|
||
|
case 16: // DecimalLiteral
|
||
|
shift(16); // DecimalLiteral
|
||
|
break;
|
||
|
case 17: // DoubleLiteral
|
||
|
shift(17); // DoubleLiteral
|
||
|
break;
|
||
|
case 5: // Variable
|
||
|
shift(5); // Variable
|
||
|
break;
|
||
|
case 6: // Tag
|
||
|
shift(6); // Tag
|
||
|
break;
|
||
|
case 4: // Operator
|
||
|
shift(4); // Operator
|
||
|
break;
|
||
|
case 33: // EOF
|
||
|
shift(33); // EOF
|
||
|
break;
|
||
|
default:
|
||
|
parse_EQName();
|
||
|
}
|
||
|
eventHandler.endNonterminal("start", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_StartTag = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("StartTag", e0);
|
||
|
lookahead1W(8); // QName | S^WS | EOF | '"' | "'" | '/>' | '=' | '>'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 58: // '>'
|
||
|
shift(58); // '>'
|
||
|
break;
|
||
|
case 50: // '/>'
|
||
|
shift(50); // '/>'
|
||
|
break;
|
||
|
case 27: // QName
|
||
|
shift(27); // QName
|
||
|
break;
|
||
|
case 57: // '='
|
||
|
shift(57); // '='
|
||
|
break;
|
||
|
case 35: // '"'
|
||
|
shift(35); // '"'
|
||
|
break;
|
||
|
case 38: // "'"
|
||
|
shift(38); // "'"
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("StartTag", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_TagContent = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("TagContent", e0);
|
||
|
lookahead1(11); // Tag | EndTag | PredefinedEntityRef | ElementContentChar | CharRef | EOF |
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 23: // ElementContentChar
|
||
|
shift(23); // ElementContentChar
|
||
|
break;
|
||
|
case 6: // Tag
|
||
|
shift(6); // Tag
|
||
|
break;
|
||
|
case 7: // EndTag
|
||
|
shift(7); // EndTag
|
||
|
break;
|
||
|
case 55: // '<![CDATA['
|
||
|
shift(55); // '<![CDATA['
|
||
|
break;
|
||
|
case 54: // '<!--'
|
||
|
shift(54); // '<!--'
|
||
|
break;
|
||
|
case 18: // PredefinedEntityRef
|
||
|
shift(18); // PredefinedEntityRef
|
||
|
break;
|
||
|
case 29: // CharRef
|
||
|
shift(29); // CharRef
|
||
|
break;
|
||
|
case 272: // '{{'
|
||
|
shift(272); // '{{'
|
||
|
break;
|
||
|
case 275: // '}}'
|
||
|
shift(275); // '}}'
|
||
|
break;
|
||
|
case 271: // '{'
|
||
|
shift(271); // '{'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("TagContent", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_AposAttr = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("AposAttr", e0);
|
||
|
lookahead1(10); // PredefinedEntityRef | EscapeApos | AposAttrContentChar | CharRef | EOF | "'" |
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 20: // EscapeApos
|
||
|
shift(20); // EscapeApos
|
||
|
break;
|
||
|
case 25: // AposAttrContentChar
|
||
|
shift(25); // AposAttrContentChar
|
||
|
break;
|
||
|
case 18: // PredefinedEntityRef
|
||
|
shift(18); // PredefinedEntityRef
|
||
|
break;
|
||
|
case 29: // CharRef
|
||
|
shift(29); // CharRef
|
||
|
break;
|
||
|
case 272: // '{{'
|
||
|
shift(272); // '{{'
|
||
|
break;
|
||
|
case 275: // '}}'
|
||
|
shift(275); // '}}'
|
||
|
break;
|
||
|
case 271: // '{'
|
||
|
shift(271); // '{'
|
||
|
break;
|
||
|
case 38: // "'"
|
||
|
shift(38); // "'"
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("AposAttr", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_QuotAttr = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("QuotAttr", e0);
|
||
|
lookahead1(9); // PredefinedEntityRef | EscapeQuot | QuotAttrContentChar | CharRef | EOF | '"' |
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 19: // EscapeQuot
|
||
|
shift(19); // EscapeQuot
|
||
|
break;
|
||
|
case 24: // QuotAttrContentChar
|
||
|
shift(24); // QuotAttrContentChar
|
||
|
break;
|
||
|
case 18: // PredefinedEntityRef
|
||
|
shift(18); // PredefinedEntityRef
|
||
|
break;
|
||
|
case 29: // CharRef
|
||
|
shift(29); // CharRef
|
||
|
break;
|
||
|
case 272: // '{{'
|
||
|
shift(272); // '{{'
|
||
|
break;
|
||
|
case 275: // '}}'
|
||
|
shift(275); // '}}'
|
||
|
break;
|
||
|
case 271: // '{'
|
||
|
shift(271); // '{'
|
||
|
break;
|
||
|
case 35: // '"'
|
||
|
shift(35); // '"'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("QuotAttr", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_CData = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("CData", e0);
|
||
|
lookahead1(1); // CDataSectionContents | EOF | ']]>'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 11: // CDataSectionContents
|
||
|
shift(11); // CDataSectionContents
|
||
|
break;
|
||
|
case 64: // ']]>'
|
||
|
shift(64); // ']]>'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("CData", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_XMLComment = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("XMLComment", e0);
|
||
|
lookahead1(0); // DirCommentContents | EOF | '-->'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 9: // DirCommentContents
|
||
|
shift(9); // DirCommentContents
|
||
|
break;
|
||
|
case 47: // '-->'
|
||
|
shift(47); // '-->'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("XMLComment", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_PI = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("PI", e0);
|
||
|
lookahead1(3); // DirPIContents | EOF | '?' | '?>'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 10: // DirPIContents
|
||
|
shift(10); // DirPIContents
|
||
|
break;
|
||
|
case 59: // '?'
|
||
|
shift(59); // '?'
|
||
|
break;
|
||
|
case 60: // '?>'
|
||
|
shift(60); // '?>'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("PI", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_Pragma = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("Pragma", e0);
|
||
|
lookahead1(2); // PragmaContents | EOF | '#' | '#)'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 8: // PragmaContents
|
||
|
shift(8); // PragmaContents
|
||
|
break;
|
||
|
case 36: // '#'
|
||
|
shift(36); // '#'
|
||
|
break;
|
||
|
case 37: // '#)'
|
||
|
shift(37); // '#)'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("Pragma", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_Comment = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("Comment", e0);
|
||
|
lookahead1(4); // CommentContents | EOF | '(:' | ':)'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 52: // ':)'
|
||
|
shift(52); // ':)'
|
||
|
break;
|
||
|
case 41: // '(:'
|
||
|
shift(41); // '(:'
|
||
|
break;
|
||
|
case 30: // CommentContents
|
||
|
shift(30); // CommentContents
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("Comment", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_CommentDoc = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("CommentDoc", e0);
|
||
|
lookahead1(5); // DocTag | DocCommentContents | EOF | '(:' | ':)'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 31: // DocTag
|
||
|
shift(31); // DocTag
|
||
|
break;
|
||
|
case 32: // DocCommentContents
|
||
|
shift(32); // DocCommentContents
|
||
|
break;
|
||
|
case 52: // ':)'
|
||
|
shift(52); // ':)'
|
||
|
break;
|
||
|
case 41: // '(:'
|
||
|
shift(41); // '(:'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("CommentDoc", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_QuotString = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("QuotString", e0);
|
||
|
lookahead1(6); // PredefinedEntityRef | EscapeQuot | QuotChar | CharRef | EOF | '"'
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 18: // PredefinedEntityRef
|
||
|
shift(18); // PredefinedEntityRef
|
||
|
break;
|
||
|
case 29: // CharRef
|
||
|
shift(29); // CharRef
|
||
|
break;
|
||
|
case 19: // EscapeQuot
|
||
|
shift(19); // EscapeQuot
|
||
|
break;
|
||
|
case 21: // QuotChar
|
||
|
shift(21); // QuotChar
|
||
|
break;
|
||
|
case 35: // '"'
|
||
|
shift(35); // '"'
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("QuotString", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_AposString = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("AposString", e0);
|
||
|
lookahead1(7); // PredefinedEntityRef | EscapeApos | AposChar | CharRef | EOF | "'"
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 18: // PredefinedEntityRef
|
||
|
shift(18); // PredefinedEntityRef
|
||
|
break;
|
||
|
case 29: // CharRef
|
||
|
shift(29); // CharRef
|
||
|
break;
|
||
|
case 20: // EscapeApos
|
||
|
shift(20); // EscapeApos
|
||
|
break;
|
||
|
case 22: // AposChar
|
||
|
shift(22); // AposChar
|
||
|
break;
|
||
|
case 38: // "'"
|
||
|
shift(38); // "'"
|
||
|
break;
|
||
|
default:
|
||
|
shift(33); // EOF
|
||
|
}
|
||
|
eventHandler.endNonterminal("AposString", e0);
|
||
|
};
|
||
|
|
||
|
this.parse_Prefix = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("Prefix", e0);
|
||
|
lookahead1W(13); // NCName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
|
||
|
whitespace();
|
||
|
parse_NCName();
|
||
|
eventHandler.endNonterminal("Prefix", e0);
|
||
|
};
|
||
|
|
||
|
this.parse__EQName = function()
|
||
|
{
|
||
|
eventHandler.startNonterminal("_EQName", e0);
|
||
|
lookahead1W(12); // EQName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
|
||
|
whitespace();
|
||
|
parse_EQName();
|
||
|
eventHandler.endNonterminal("_EQName", e0);
|
||
|
};
|
||
|
|
||
|
function parse_EQName()
|
||
|
{
|
||
|
eventHandler.startNonterminal("EQName", e0);
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 77: // 'attribute'
|
||
|
shift(77); // 'attribute'
|
||
|
break;
|
||
|
case 91: // 'comment'
|
||
|
shift(91); // 'comment'
|
||
|
break;
|
||
|
case 115: // 'document-node'
|
||
|
shift(115); // 'document-node'
|
||
|
break;
|
||
|
case 116: // 'element'
|
||
|
shift(116); // 'element'
|
||
|
break;
|
||
|
case 119: // 'empty-sequence'
|
||
|
shift(119); // 'empty-sequence'
|
||
|
break;
|
||
|
case 140: // 'function'
|
||
|
shift(140); // 'function'
|
||
|
break;
|
||
|
case 147: // 'if'
|
||
|
shift(147); // 'if'
|
||
|
break;
|
||
|
case 160: // 'item'
|
||
|
shift(160); // 'item'
|
||
|
break;
|
||
|
case 180: // 'namespace-node'
|
||
|
shift(180); // 'namespace-node'
|
||
|
break;
|
||
|
case 186: // 'node'
|
||
|
shift(186); // 'node'
|
||
|
break;
|
||
|
case 211: // 'processing-instruction'
|
||
|
shift(211); // 'processing-instruction'
|
||
|
break;
|
||
|
case 221: // 'schema-attribute'
|
||
|
shift(221); // 'schema-attribute'
|
||
|
break;
|
||
|
case 222: // 'schema-element'
|
||
|
shift(222); // 'schema-element'
|
||
|
break;
|
||
|
case 238: // 'switch'
|
||
|
shift(238); // 'switch'
|
||
|
break;
|
||
|
case 239: // 'text'
|
||
|
shift(239); // 'text'
|
||
|
break;
|
||
|
case 248: // 'typeswitch'
|
||
|
shift(248); // 'typeswitch'
|
||
|
break;
|
||
|
default:
|
||
|
parse_FunctionName();
|
||
|
}
|
||
|
eventHandler.endNonterminal("EQName", e0);
|
||
|
}
|
||
|
|
||
|
function parse_FunctionName()
|
||
|
{
|
||
|
eventHandler.startNonterminal("FunctionName", e0);
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 14: // EQName^Token
|
||
|
shift(14); // EQName^Token
|
||
|
break;
|
||
|
case 65: // 'after'
|
||
|
shift(65); // 'after'
|
||
|
break;
|
||
|
case 68: // 'ancestor'
|
||
|
shift(68); // 'ancestor'
|
||
|
break;
|
||
|
case 69: // 'ancestor-or-self'
|
||
|
shift(69); // 'ancestor-or-self'
|
||
|
break;
|
||
|
case 70: // 'and'
|
||
|
shift(70); // 'and'
|
||
|
break;
|
||
|
case 74: // 'as'
|
||
|
shift(74); // 'as'
|
||
|
break;
|
||
|
case 75: // 'ascending'
|
||
|
shift(75); // 'ascending'
|
||
|
break;
|
||
|
case 79: // 'before'
|
||
|
shift(79); // 'before'
|
||
|
break;
|
||
|
case 83: // 'case'
|
||
|
shift(83); // 'case'
|
||
|
break;
|
||
|
case 84: // 'cast'
|
||
|
shift(84); // 'cast'
|
||
|
break;
|
||
|
case 85: // 'castable'
|
||
|
shift(85); // 'castable'
|
||
|
break;
|
||
|
case 88: // 'child'
|
||
|
shift(88); // 'child'
|
||
|
break;
|
||
|
case 89: // 'collation'
|
||
|
shift(89); // 'collation'
|
||
|
break;
|
||
|
case 98: // 'copy'
|
||
|
shift(98); // 'copy'
|
||
|
break;
|
||
|
case 100: // 'count'
|
||
|
shift(100); // 'count'
|
||
|
break;
|
||
|
case 103: // 'declare'
|
||
|
shift(103); // 'declare'
|
||
|
break;
|
||
|
case 104: // 'default'
|
||
|
shift(104); // 'default'
|
||
|
break;
|
||
|
case 105: // 'delete'
|
||
|
shift(105); // 'delete'
|
||
|
break;
|
||
|
case 106: // 'descendant'
|
||
|
shift(106); // 'descendant'
|
||
|
break;
|
||
|
case 107: // 'descendant-or-self'
|
||
|
shift(107); // 'descendant-or-self'
|
||
|
break;
|
||
|
case 108: // 'descending'
|
||
|
shift(108); // 'descending'
|
||
|
break;
|
||
|
case 113: // 'div'
|
||
|
shift(113); // 'div'
|
||
|
break;
|
||
|
case 114: // 'document'
|
||
|
shift(114); // 'document'
|
||
|
break;
|
||
|
case 117: // 'else'
|
||
|
shift(117); // 'else'
|
||
|
break;
|
||
|
case 118: // 'empty'
|
||
|
shift(118); // 'empty'
|
||
|
break;
|
||
|
case 121: // 'end'
|
||
|
shift(121); // 'end'
|
||
|
break;
|
||
|
case 123: // 'eq'
|
||
|
shift(123); // 'eq'
|
||
|
break;
|
||
|
case 124: // 'every'
|
||
|
shift(124); // 'every'
|
||
|
break;
|
||
|
case 126: // 'except'
|
||
|
shift(126); // 'except'
|
||
|
break;
|
||
|
case 129: // 'first'
|
||
|
shift(129); // 'first'
|
||
|
break;
|
||
|
case 130: // 'following'
|
||
|
shift(130); // 'following'
|
||
|
break;
|
||
|
case 131: // 'following-sibling'
|
||
|
shift(131); // 'following-sibling'
|
||
|
break;
|
||
|
case 132: // 'for'
|
||
|
shift(132); // 'for'
|
||
|
break;
|
||
|
case 141: // 'ge'
|
||
|
shift(141); // 'ge'
|
||
|
break;
|
||
|
case 143: // 'group'
|
||
|
shift(143); // 'group'
|
||
|
break;
|
||
|
case 145: // 'gt'
|
||
|
shift(145); // 'gt'
|
||
|
break;
|
||
|
case 146: // 'idiv'
|
||
|
shift(146); // 'idiv'
|
||
|
break;
|
||
|
case 148: // 'import'
|
||
|
shift(148); // 'import'
|
||
|
break;
|
||
|
case 154: // 'insert'
|
||
|
shift(154); // 'insert'
|
||
|
break;
|
||
|
case 155: // 'instance'
|
||
|
shift(155); // 'instance'
|
||
|
break;
|
||
|
case 157: // 'intersect'
|
||
|
shift(157); // 'intersect'
|
||
|
break;
|
||
|
case 158: // 'into'
|
||
|
shift(158); // 'into'
|
||
|
break;
|
||
|
case 159: // 'is'
|
||
|
shift(159); // 'is'
|
||
|
break;
|
||
|
case 165: // 'last'
|
||
|
shift(165); // 'last'
|
||
|
break;
|
||
|
case 167: // 'le'
|
||
|
shift(167); // 'le'
|
||
|
break;
|
||
|
case 169: // 'let'
|
||
|
shift(169); // 'let'
|
||
|
break;
|
||
|
case 173: // 'lt'
|
||
|
shift(173); // 'lt'
|
||
|
break;
|
||
|
case 175: // 'mod'
|
||
|
shift(175); // 'mod'
|
||
|
break;
|
||
|
case 176: // 'modify'
|
||
|
shift(176); // 'modify'
|
||
|
break;
|
||
|
case 177: // 'module'
|
||
|
shift(177); // 'module'
|
||
|
break;
|
||
|
case 179: // 'namespace'
|
||
|
shift(179); // 'namespace'
|
||
|
break;
|
||
|
case 181: // 'ne'
|
||
|
shift(181); // 'ne'
|
||
|
break;
|
||
|
case 193: // 'only'
|
||
|
shift(193); // 'only'
|
||
|
break;
|
||
|
case 195: // 'or'
|
||
|
shift(195); // 'or'
|
||
|
break;
|
||
|
case 196: // 'order'
|
||
|
shift(196); // 'order'
|
||
|
break;
|
||
|
case 197: // 'ordered'
|
||
|
shift(197); // 'ordered'
|
||
|
break;
|
||
|
case 201: // 'parent'
|
||
|
shift(201); // 'parent'
|
||
|
break;
|
||
|
case 207: // 'preceding'
|
||
|
shift(207); // 'preceding'
|
||
|
break;
|
||
|
case 208: // 'preceding-sibling'
|
||
|
shift(208); // 'preceding-sibling'
|
||
|
break;
|
||
|
case 213: // 'rename'
|
||
|
shift(213); // 'rename'
|
||
|
break;
|
||
|
case 214: // 'replace'
|
||
|
shift(214); // 'replace'
|
||
|
break;
|
||
|
case 215: // 'return'
|
||
|
shift(215); // 'return'
|
||
|
break;
|
||
|
case 219: // 'satisfies'
|
||
|
shift(219); // 'satisfies'
|
||
|
break;
|
||
|
case 224: // 'self'
|
||
|
shift(224); // 'self'
|
||
|
break;
|
||
|
case 230: // 'some'
|
||
|
shift(230); // 'some'
|
||
|
break;
|
||
|
case 231: // 'stable'
|
||
|
shift(231); // 'stable'
|
||
|
break;
|
||
|
case 232: // 'start'
|
||
|
shift(232); // 'start'
|
||
|
break;
|
||
|
case 243: // 'to'
|
||
|
shift(243); // 'to'
|
||
|
break;
|
||
|
case 244: // 'treat'
|
||
|
shift(244); // 'treat'
|
||
|
break;
|
||
|
case 245: // 'try'
|
||
|
shift(245); // 'try'
|
||
|
break;
|
||
|
case 249: // 'union'
|
||
|
shift(249); // 'union'
|
||
|
break;
|
||
|
case 251: // 'unordered'
|
||
|
shift(251); // 'unordered'
|
||
|
break;
|
||
|
case 255: // 'validate'
|
||
|
shift(255); // 'validate'
|
||
|
break;
|
||
|
case 261: // 'where'
|
||
|
shift(261); // 'where'
|
||
|
break;
|
||
|
case 265: // 'with'
|
||
|
shift(265); // 'with'
|
||
|
break;
|
||
|
case 269: // 'xquery'
|
||
|
shift(269); // 'xquery'
|
||
|
break;
|
||
|
case 67: // 'allowing'
|
||
|
shift(67); // 'allowing'
|
||
|
break;
|
||
|
case 76: // 'at'
|
||
|
shift(76); // 'at'
|
||
|
break;
|
||
|
case 78: // 'base-uri'
|
||
|
shift(78); // 'base-uri'
|
||
|
break;
|
||
|
case 80: // 'boundary-space'
|
||
|
shift(80); // 'boundary-space'
|
||
|
break;
|
||
|
case 81: // 'break'
|
||
|
shift(81); // 'break'
|
||
|
break;
|
||
|
case 86: // 'catch'
|
||
|
shift(86); // 'catch'
|
||
|
break;
|
||
|
case 93: // 'construction'
|
||
|
shift(93); // 'construction'
|
||
|
break;
|
||
|
case 96: // 'context'
|
||
|
shift(96); // 'context'
|
||
|
break;
|
||
|
case 97: // 'continue'
|
||
|
shift(97); // 'continue'
|
||
|
break;
|
||
|
case 99: // 'copy-namespaces'
|
||
|
shift(99); // 'copy-namespaces'
|
||
|
break;
|
||
|
case 101: // 'decimal-format'
|
||
|
shift(101); // 'decimal-format'
|
||
|
break;
|
||
|
case 120: // 'encoding'
|
||
|
shift(120); // 'encoding'
|
||
|
break;
|
||
|
case 127: // 'exit'
|
||
|
shift(127); // 'exit'
|
||
|
break;
|
||
|
case 128: // 'external'
|
||
|
shift(128); // 'external'
|
||
|
break;
|
||
|
case 136: // 'ft-option'
|
||
|
shift(136); // 'ft-option'
|
||
|
break;
|
||
|
case 149: // 'in'
|
||
|
shift(149); // 'in'
|
||
|
break;
|
||
|
case 150: // 'index'
|
||
|
shift(150); // 'index'
|
||
|
break;
|
||
|
case 156: // 'integrity'
|
||
|
shift(156); // 'integrity'
|
||
|
break;
|
||
|
case 166: // 'lax'
|
||
|
shift(166); // 'lax'
|
||
|
break;
|
||
|
case 187: // 'nodes'
|
||
|
shift(187); // 'nodes'
|
||
|
break;
|
||
|
case 194: // 'option'
|
||
|
shift(194); // 'option'
|
||
|
break;
|
||
|
case 198: // 'ordering'
|
||
|
shift(198); // 'ordering'
|
||
|
break;
|
||
|
case 217: // 'revalidation'
|
||
|
shift(217); // 'revalidation'
|
||
|
break;
|
||
|
case 220: // 'schema'
|
||
|
shift(220); // 'schema'
|
||
|
break;
|
||
|
case 223: // 'score'
|
||
|
shift(223); // 'score'
|
||
|
break;
|
||
|
case 229: // 'sliding'
|
||
|
shift(229); // 'sliding'
|
||
|
break;
|
||
|
case 235: // 'strict'
|
||
|
shift(235); // 'strict'
|
||
|
break;
|
||
|
case 246: // 'tumbling'
|
||
|
shift(246); // 'tumbling'
|
||
|
break;
|
||
|
case 247: // 'type'
|
||
|
shift(247); // 'type'
|
||
|
break;
|
||
|
case 252: // 'updating'
|
||
|
shift(252); // 'updating'
|
||
|
break;
|
||
|
case 256: // 'value'
|
||
|
shift(256); // 'value'
|
||
|
break;
|
||
|
case 257: // 'variable'
|
||
|
shift(257); // 'variable'
|
||
|
break;
|
||
|
case 258: // 'version'
|
||
|
shift(258); // 'version'
|
||
|
break;
|
||
|
case 262: // 'while'
|
||
|
shift(262); // 'while'
|
||
|
break;
|
||
|
case 92: // 'constraint'
|
||
|
shift(92); // 'constraint'
|
||
|
break;
|
||
|
case 171: // 'loop'
|
||
|
shift(171); // 'loop'
|
||
|
break;
|
||
|
default:
|
||
|
shift(216); // 'returning'
|
||
|
}
|
||
|
eventHandler.endNonterminal("FunctionName", e0);
|
||
|
}
|
||
|
|
||
|
function parse_NCName()
|
||
|
{
|
||
|
eventHandler.startNonterminal("NCName", e0);
|
||
|
switch (l1)
|
||
|
{
|
||
|
case 26: // NCName^Token
|
||
|
shift(26); // NCName^Token
|
||
|
break;
|
||
|
case 65: // 'after'
|
||
|
shift(65); // 'after'
|
||
|
break;
|
||
|
case 70: // 'and'
|
||
|
shift(70); // 'and'
|
||
|
break;
|
||
|
case 74: // 'as'
|
||
|
shift(74); // 'as'
|
||
|
break;
|
||
|
case 75: // 'ascending'
|
||
|
shift(75); // 'ascending'
|
||
|
break;
|
||
|
case 79: // 'before'
|
||
|
shift(79); // 'before'
|
||
|
break;
|
||
|
case 83: // 'case'
|
||
|
shift(83); // 'case'
|
||
|
break;
|
||
|
case 84: // 'cast'
|
||
|
shift(84); // 'cast'
|
||
|
break;
|
||
|
case 85: // 'castable'
|
||
|
shift(85); // 'castable'
|
||
|
break;
|
||
|
case 89: // 'collation'
|
||
|
shift(89); // 'collation'
|
||
|
break;
|
||
|
case 100: // 'count'
|
||
|
shift(100); // 'count'
|
||
|
break;
|
||
|
case 104: // 'default'
|
||
|
shift(104); // 'default'
|
||
|
break;
|
||
|
case 108: // 'descending'
|
||
|
shift(108); // 'descending'
|
||
|
break;
|
||
|
case 113: // 'div'
|
||
|
shift(113); // 'div'
|
||
|
break;
|
||
|
case 117: // 'else'
|
||
|
shift(117); // 'else'
|
||
|
break;
|
||
|
case 118: // 'empty'
|
||
|
shift(118); // 'empty'
|
||
|
break;
|
||
|
case 121: // 'end'
|
||
|
shift(121); // 'end'
|
||
|
break;
|
||
|
case 123: // 'eq'
|
||
|
shift(123); // 'eq'
|
||
|
break;
|
||
|
case 126: // 'except'
|
||
|
shift(126); // 'except'
|
||
|
break;
|
||
|
case 132: // 'for'
|
||
|
shift(132); // 'for'
|
||
|
break;
|
||
|
case 141: // 'ge'
|
||
|
shift(141); // 'ge'
|
||
|
break;
|
||
|
case 143: // 'group'
|
||
|
shift(143); // 'group'
|
||
|
break;
|
||
|
case 145: // 'gt'
|
||
|
shift(145); // 'gt'
|
||
|
break;
|
||
|
case 146: // 'idiv'
|
||
|
shift(146); // 'idiv'
|
||
|
break;
|
||
|
case 155: // 'instance'
|
||
|
shift(155); // 'instance'
|
||
|
break;
|
||
|
case 157: // 'intersect'
|
||
|
shift(157); // 'intersect'
|
||
|
break;
|
||
|
case 158: // 'into'
|
||
|
shift(158); // 'into'
|
||
|
break;
|
||
|
case 159: // 'is'
|
||
|
shift(159); // 'is'
|
||
|
break;
|
||
|
case 167: // 'le'
|
||
|
shift(167); // 'le'
|
||
|
break;
|
||
|
case 169: // 'let'
|
||
|
shift(169); // 'let'
|
||
|
break;
|
||
|
case 173: // 'lt'
|
||
|
shift(173); // 'lt'
|
||
|
break;
|
||
|
case 175: // 'mod'
|
||
|
shift(175); // 'mod'
|
||
|
break;
|
||
|
case 176: // 'modify'
|
||
|
shift(176); // 'modify'
|
||
|
break;
|
||
|
case 181: // 'ne'
|
||
|
shift(181); // 'ne'
|
||
|
break;
|
||
|
case 193: // 'only'
|
||
|
shift(193); // 'only'
|
||
|
break;
|
||
|
case 195: // 'or'
|
||
|
shift(195); // 'or'
|
||
|
break;
|
||
|
case 196: // 'order'
|
||
|
shift(196); // 'order'
|
||
|
break;
|
||
|
case 215: // 'return'
|
||
|
shift(215); // 'return'
|
||
|
break;
|
||
|
case 219: // 'satisfies'
|
||
|
shift(219); // 'satisfies'
|
||
|
break;
|
||
|
case 231: // 'stable'
|
||
|
shift(231); // 'stable'
|
||
|
break;
|
||
|
case 232: // 'start'
|
||
|
shift(232); // 'start'
|
||
|
break;
|
||
|
case 243: // 'to'
|
||
|
shift(243); // 'to'
|
||
|
break;
|
||
|
case 244: // 'treat'
|
||
|
shift(244); // 'treat'
|
||
|
break;
|
||
|
case 249: // 'union'
|
||
|
shift(249); // 'union'
|
||
|
break;
|
||
|
case 261: // 'where'
|
||
|
shift(261); // 'where'
|
||
|
break;
|
||
|
case 265: // 'with'
|
||
|
shift(265); // 'with'
|
||
|
break;
|
||
|
case 68: // 'ancestor'
|
||
|
shift(68); // 'ancestor'
|
||
|
break;
|
||
|
case 69: // 'ancestor-or-self'
|
||
|
shift(69); // 'ancestor-or-self'
|
||
|
break;
|
||
|
case 77: // 'attribute'
|
||
|
shift(77); // 'attribute'
|
||
|
break;
|
||
|
case 88: // 'child'
|
||
|
shift(88); // 'child'
|
||
|
break;
|
||
|
case 91: // 'comment'
|
||
|
shift(91); // 'comment'
|
||
|
break;
|
||
|
case 98: // 'copy'
|
||
|
shift(98); // 'copy'
|
||
|
break;
|
||
|
case 103: // 'declare'
|
||
|
shift(103); // 'declare'
|
||
|
break;
|
||
|
case 105: // 'delete'
|
||
|
shift(105); // 'delete'
|
||
|
break;
|
||
|
case 106: // 'descendant'
|
||
|
shift(106); // 'descendant'
|
||
|
break;
|
||
|
case 107: // 'descendant-or-self'
|
||
|
shift(107); // 'descendant-or-self'
|
||
|
break;
|
||
|
case 114: // 'document'
|
||
|
shift(114); // 'document'
|
||
|
break;
|
||
|
case 115: // 'document-node'
|
||
|
shift(115); // 'document-node'
|
||
|
break;
|
||
|
case 116: // 'element'
|
||
|
shift(116); // 'element'
|
||
|
break;
|
||
|
case 119: // 'empty-sequence'
|
||
|
shift(119); // 'empty-sequence'
|
||
|
break;
|
||
|
case 124: // 'every'
|
||
|
shift(124); // 'every'
|
||
|
break;
|
||
|
case 129: // 'first'
|
||
|
shift(129); // 'first'
|
||
|
break;
|
||
|
case 130: // 'following'
|
||
|
shift(130); // 'following'
|
||
|
break;
|
||
|
case 131: // 'following-sibling'
|
||
|
shift(131); // 'following-sibling'
|
||
|
break;
|
||
|
case 140: // 'function'
|
||
|
shift(140); // 'function'
|
||
|
break;
|
||
|
case 147: // 'if'
|
||
|
shift(147); // 'if'
|
||
|
break;
|
||
|
case 148: // 'import'
|
||
|
shift(148); // 'import'
|
||
|
break;
|
||
|
case 154: // 'insert'
|
||
|
shift(154); // 'insert'
|
||
|
break;
|
||
|
case 160: // 'item'
|
||
|
shift(160); // 'item'
|
||
|
break;
|
||
|
case 165: // 'last'
|
||
|
shift(165); // 'last'
|
||
|
break;
|
||
|
case 177: // 'module'
|
||
|
shift(177); // 'module'
|
||
|
break;
|
||
|
case 179: // 'namespace'
|
||
|
shift(179); // 'namespace'
|
||
|
break;
|
||
|
case 180: // 'namespace-node'
|
||
|
shift(180); // 'namespace-node'
|
||
|
break;
|
||
|
case 186: // 'node'
|
||
|
shift(186); // 'node'
|
||
|
break;
|
||
|
case 197: // 'ordered'
|
||
|
shift(197); // 'ordered'
|
||
|
break;
|
||
|
case 201: // 'parent'
|
||
|
shift(201); // 'parent'
|
||
|
break;
|
||
|
case 207: // 'preceding'
|
||
|
shift(207); // 'preceding'
|
||
|
break;
|
||
|
case 208: // 'preceding-sibling'
|
||
|
shift(208); // 'preceding-sibling'
|
||
|
break;
|
||
|
case 211: // 'processing-instruction'
|
||
|
shift(211); // 'processing-instruction'
|
||
|
break;
|
||
|
case 213: // 'rename'
|
||
|
shift(213); // 'rename'
|
||
|
break;
|
||
|
case 214: // 'replace'
|
||
|
shift(214); // 'replace'
|
||
|
break;
|
||
|
case 221: // 'schema-attribute'
|
||
|
shift(221); // 'schema-attribute'
|
||
|
break;
|
||
|
case 222: // 'schema-element'
|
||
|
shift(222); // 'schema-element'
|
||
|
break;
|
||
|
case 224: // 'self'
|
||
|
shift(224); // 'self'
|
||
|
break;
|
||
|
case 230: // 'some'
|
||
|
shift(230); // 'some'
|
||
|
break;
|
||
|
case 238: // 'switch'
|
||
|
shift(238); // 'switch'
|
||
|
break;
|
||
|
case 239: // 'text'
|
||
|
shift(239); // 'text'
|
||
|
break;
|
||
|
case 245: // 'try'
|
||
|
shift(245); // 'try'
|
||
|
break;
|
||
|
case 248: // 'typeswitch'
|
||
|
shift(248); // 'typeswitch'
|
||
|
break;
|
||
|
case 251: // 'unordered'
|
||
|
shift(251); // 'unordered'
|
||
|
break;
|
||
|
case 255: // 'validate'
|
||
|
shift(255); // 'validate'
|
||
|
break;
|
||
|
case 257: // 'variable'
|
||
|
shift(257); // 'variable'
|
||
|
break;
|
||
|
case 269: // 'xquery'
|
||
|
shift(269); // 'xquery'
|
||
|
break;
|
||
|
case 67: // 'allowing'
|
||
|
shift(67); // 'allowing'
|
||
|
break;
|
||
|
case 76: // 'at'
|
||
|
shift(76); // 'at'
|
||
|
break;
|
||
|
case 78: // 'base-uri'
|
||
|
shift(78); // 'base-uri'
|
||
|
break;
|
||
|
case 80: // 'boundary-space'
|
||
|
shift(80); // 'boundary-space'
|
||
|
break;
|
||
|
case 81: // 'break'
|
||
|
shift(81); // 'break'
|
||
|
break;
|
||
|
case 86: // 'catch'
|
||
|
shift(86); // 'catch'
|
||
|
break;
|
||
|
case 93: // 'construction'
|
||
|
shift(93); // 'construction'
|
||
|
break;
|
||
|
case 96: // 'context'
|
||
|
shift(96); // 'context'
|
||
|
break;
|
||
|
case 97: // 'continue'
|
||
|
shift(97); // 'continue'
|
||
|
break;
|
||
|
case 99: // 'copy-namespaces'
|
||
|
shift(99); // 'copy-namespaces'
|
||
|
break;
|
||
|
case 101: // 'decimal-format'
|
||
|
shift(101); // 'decimal-format'
|
||
|
break;
|
||
|
case 120: // 'encoding'
|
||
|
shift(120); // 'encoding'
|
||
|
break;
|
||
|
case 127: // 'exit'
|
||
|
shift(127); // 'exit'
|
||
|
break;
|
||
|
case 128: // 'external'
|
||
|
shift(128); // 'external'
|
||
|
break;
|
||
|
case 136: // 'ft-option'
|
||
|
shift(136); // 'ft-option'
|
||
|
break;
|
||
|
case 149: // 'in'
|
||
|
shift(149); // 'in'
|
||
|
break;
|
||
|
case 150: // 'index'
|
||
|
shift(150); // 'index'
|
||
|
break;
|
||
|
case 156: // 'integrity'
|
||
|
shift(156); // 'integrity'
|
||
|
break;
|
||
|
case 166: // 'lax'
|
||
|
shift(166); // 'lax'
|
||
|
break;
|
||
|
case 187: // 'nodes'
|
||
|
shift(187); // 'nodes'
|
||
|
break;
|
||
|
case 194: // 'option'
|
||
|
shift(194); // 'option'
|
||
|
break;
|
||
|
case 198: // 'ordering'
|
||
|
shift(198); // 'ordering'
|
||
|
break;
|
||
|
case 217: // 'revalidation'
|
||
|
shift(217); // 'revalidation'
|
||
|
break;
|
||
|
case 220: // 'schema'
|
||
|
shift(220); // 'schema'
|
||
|
break;
|
||
|
case 223: // 'score'
|
||
|
shift(223); // 'score'
|
||
|
break;
|
||
|
case 229: // 'sliding'
|
||
|
shift(229); // 'sliding'
|
||
|
break;
|
||
|
case 235: // 'strict'
|
||
|
shift(235); // 'strict'
|
||
|
break;
|
||
|
case 246: // 'tumbling'
|
||
|
shift(246); // 'tumbling'
|
||
|
break;
|
||
|
case 247: // 'type'
|
||
|
shift(247); // 'type'
|
||
|
break;
|
||
|
case 252: // 'updating'
|
||
|
shift(252); // 'updating'
|
||
|
break;
|
||
|
case 256: // 'value'
|
||
|
shift(256); // 'value'
|
||
|
break;
|
||
|
case 258: // 'version'
|
||
|
shift(258); // 'version'
|
||
|
break;
|
||
|
case 262: // 'while'
|
||
|
shift(262); // 'while'
|
||
|
break;
|
||
|
case 92: // 'constraint'
|
||
|
shift(92); // 'constraint'
|
||
|
break;
|
||
|
case 171: // 'loop'
|
||
|
shift(171); // 'loop'
|
||
|
break;
|
||
|
default:
|
||
|
shift(216); // 'returning'
|
||
|
}
|
||
|
eventHandler.endNonterminal("NCName", e0);
|
||
|
}
|
||
|
|
||
|
function shift(t)
|
||
|
{
|
||
|
if (l1 == t)
|
||
|
{
|
||
|
whitespace();
|
||
|
eventHandler.terminal(JSONiqTokenizer.TOKEN[l1], b1, e1 > size ? size : e1);
|
||
|
b0 = b1; e0 = e1; l1 = 0;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
error(b1, e1, 0, l1, t);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function whitespace()
|
||
|
{
|
||
|
if (e0 != b1)
|
||
|
{
|
||
|
b0 = e0;
|
||
|
e0 = b1;
|
||
|
eventHandler.whitespace(b0, e0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function matchW(set)
|
||
|
{
|
||
|
var code;
|
||
|
for (;;)
|
||
|
{
|
||
|
code = match(set);
|
||
|
if (code != 28) // S^WS
|
||
|
{
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return code;
|
||
|
}
|
||
|
|
||
|
function lookahead1W(set)
|
||
|
{
|
||
|
if (l1 == 0)
|
||
|
{
|
||
|
l1 = matchW(set);
|
||
|
b1 = begin;
|
||
|
e1 = end;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function lookahead1(set)
|
||
|
{
|
||
|
if (l1 == 0)
|
||
|
{
|
||
|
l1 = match(set);
|
||
|
b1 = begin;
|
||
|
e1 = end;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function error(b, e, s, l, t)
|
||
|
{
|
||
|
throw new self.ParseException(b, e, s, l, t);
|
||
|
}
|
||
|
|
||
|
var lk, b0, e0;
|
||
|
var l1, b1, e1;
|
||
|
var eventHandler;
|
||
|
|
||
|
var input;
|
||
|
var size;
|
||
|
var begin;
|
||
|
var end;
|
||
|
|
||
|
function match(tokenSetId)
|
||
|
{
|
||
|
var nonbmp = false;
|
||
|
begin = end;
|
||
|
var current = end;
|
||
|
var result = JSONiqTokenizer.INITIAL[tokenSetId];
|
||
|
var state = 0;
|
||
|
|
||
|
for (var code = result & 4095; code != 0; )
|
||
|
{
|
||
|
var charclass;
|
||
|
var c0 = current < size ? input.charCodeAt(current) : 0;
|
||
|
++current;
|
||
|
if (c0 < 0x80)
|
||
|
{
|
||
|
charclass = JSONiqTokenizer.MAP0[c0];
|
||
|
}
|
||
|
else if (c0 < 0xd800)
|
||
|
{
|
||
|
var c1 = c0 >> 4;
|
||
|
charclass = JSONiqTokenizer.MAP1[(c0 & 15) + JSONiqTokenizer.MAP1[(c1 & 31) + JSONiqTokenizer.MAP1[c1 >> 5]]];
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (c0 < 0xdc00)
|
||
|
{
|
||
|
var c1 = current < size ? input.charCodeAt(current) : 0;
|
||
|
if (c1 >= 0xdc00 && c1 < 0xe000)
|
||
|
{
|
||
|
++current;
|
||
|
c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000;
|
||
|
nonbmp = true;
|
||
|
}
|
||
|
}
|
||
|
var lo = 0, hi = 5;
|
||
|
for (var m = 3; ; m = (hi + lo) >> 1)
|
||
|
{
|
||
|
if (JSONiqTokenizer.MAP2[m] > c0) hi = m - 1;
|
||
|
else if (JSONiqTokenizer.MAP2[6 + m] < c0) lo = m + 1;
|
||
|
else {charclass = JSONiqTokenizer.MAP2[12 + m]; break;}
|
||
|
if (lo > hi) {charclass = 0; break;}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
state = code;
|
||
|
var i0 = (charclass << 12) + code - 1;
|
||
|
code = JSONiqTokenizer.TRANSITION[(i0 & 15) + JSONiqTokenizer.TRANSITION[i0 >> 4]];
|
||
|
|
||
|
if (code > 4095)
|
||
|
{
|
||
|
result = code;
|
||
|
code &= 4095;
|
||
|
end = current;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
result >>= 12;
|
||
|
if (result == 0)
|
||
|
{
|
||
|
end = current - 1;
|
||
|
var c1 = end < size ? input.charCodeAt(end) : 0;
|
||
|
if (c1 >= 0xdc00 && c1 < 0xe000) --end;
|
||
|
return error(begin, end, state, -1, -1);
|
||
|
}
|
||
|
|
||
|
if (nonbmp)
|
||
|
{
|
||
|
for (var i = result >> 9; i > 0; --i)
|
||
|
{
|
||
|
--end;
|
||
|
var c1 = end < size ? input.charCodeAt(end) : 0;
|
||
|
if (c1 >= 0xdc00 && c1 < 0xe000) --end;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
end -= result >> 9;
|
||
|
}
|
||
|
|
||
|
return (result & 511) - 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
JSONiqTokenizer.getTokenSet = function(tokenSetId)
|
||
|
{
|
||
|
var set = [];
|
||
|
var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095;
|
||
|
for (var i = 0; i < 276; i += 32)
|
||
|
{
|
||
|
var j = i;
|
||
|
var i0 = (i >> 5) * 2062 + s - 1;
|
||
|
var i1 = i0 >> 2;
|
||
|
var i2 = i1 >> 2;
|
||
|
var f = JSONiqTokenizer.EXPECTED[(i0 & 3) + JSONiqTokenizer.EXPECTED[(i1 & 3) + JSONiqTokenizer.EXPECTED[(i2 & 3) + JSONiqTokenizer.EXPECTED[i2 >> 2]]]];
|
||
|
for ( ; f != 0; f >>>= 1, ++j)
|
||
|
{
|
||
|
if ((f & 1) != 0)
|
||
|
{
|
||
|
set.push(JSONiqTokenizer.TOKEN[j]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return set;
|
||
|
};
|
||
|
|
||
|
JSONiqTokenizer.MAP0 =
|
||
|
[ 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35
|
||
|
];
|
||
|
|
||
|
JSONiqTokenizer.MAP1 =
|
||
|
[ 108, 124, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 156, 181, 181, 181, 181, 181, 214, 215, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 247, 261, 277, 293, 309, 347, 363, 379, 416, 416, 416, 408, 331, 323, 331, 323, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 433, 433, 433, 433, 433, 433, 433, 316, 331, 331, 331, 331, 331, 331, 331, 331, 394, 416, 416, 417, 415, 416, 416, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 35, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 31, 31, 35, 35, 35, 35, 35, 35, 35, 65, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65
|
||
|
];
|
||
|
|
||
|
JSONiqTokenizer.MAP2 =
|
||
|
[ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 35, 31, 35, 31, 31, 35
|
||
|
];
|
||
|
|
||
|
JSONiqTokenizer.INITIAL =
|
||
|
[ 1, 2, 36867, 45060, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
||
|
];
|
||
|
|
||
|
JSONiqTokenizer.TRANSITION =
|
||
|
[ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22874, 18847, 17152, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17365, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 17470, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18199, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 17890, 17922, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18065, 36544, 18632, 18081, 18098, 18114, 18159, 18185, 18215, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17756, 18816, 18429, 18445, 18143, 17393, 18500, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 18590, 21686, 17152, 19027, 19252, 17687, 19027, 28677, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17365, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 17470, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18199, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265
|
||
|
];
|
||
|
|
||
|
JSONiqTokenizer.EXPECTED =
|
||
|
[ 290, 300, 304, 353, 296, 309, 305, 319, 315, 324, 328, 352, 354, 334, 338, 330, 320, 345, 349, 293, 358, 362, 341, 366, 312, 370, 374, 378, 382, 386, 390, 394, 398, 737, 402, 634, 439, 604, 634, 634, 634, 634, 408, 634, 634, 634, 404, 634, 634, 634, 457, 634, 634, 963, 634, 634, 413, 634, 634, 634, 634, 634, 634, 634, 663, 418, 422, 903, 902, 426, 431, 548, 634, 437, 521, 919, 443, 615, 409, 449, 455, 624, 731, 751, 634, 461, 465, 672, 470, 469, 474, 481, 485, 477, 489, 493, 629, 542, 497, 505, 603, 602, 991, 648, 510, 804, 634, 515, 958, 526, 525, 530, 768, 634, 546, 552, 711, 710, 593, 558, 562, 618, 566, 570, 574, 578, 582, 586, 590, 608, 612, 660, 822, 821, 634, 622, 596, 444, 628, 533, 724, 633, 640, 653, 647, 652, 536, 1008, 451, 450, 445, 657, 670, 676, 685, 689, 693, 697, 701, 704, 707, 715, 719, 798, 815, 634, 723, 762, 996, 634, 728, 969, 730, 735, 908, 634, 741, 679, 889, 511, 747, 634, 750, 755, 499, 666, 499, 501, 759, 772, 776, 780, 634, 787, 784, 797, 802, 809, 808, 427, 814, 1006, 517, 634, 519, 853, 634, 813, 850, 793, 634, 819, 826, 833, 832, 837, 843, 847, 857, 861, 863, 867, 871, 875, 879, 883, 643, 887, 539, 980, 979, 634, 893, 944, 634, 900, 896, 634, 907, 933, 506, 912, 917, 828, 433, 636, 635, 554, 961, 923, 930, 927, 937, 941, 634, 634, 634, 974, 948, 952, 985, 913, 968, 967, 743, 634, 973, 839, 634, 978, 599, 634, 984, 989, 765, 444, 995, 1000, 634, 1003, 790, 955, 1012, 681, 634, 634, 634, 634, 634, 414, 1016, 1020, 1024, 1085, 1027, 1090, 1090, 1046, 1080, 1137, 1108, 1215, 1049, 1032, 1039, 1085, 1085, 1085, 1085, 1058, 1062, 1068, 1085, 1086, 1090, 1090, 1091, 1072, 1064, 1107, 1090, 1090, 1090, 1118, 1123, 1138, 1078, 1074, 1084, 1085, 1085, 1085, 1087, 1090, 1062, 1052, 1060, 1114, 1062, 1104, 1085, 1085, 1090, 1090, 1028, 1122, 1063, 1128, 1139, 1127, 1158, 1085, 1085, 1151, 1090, 1090, 1090, 1095, 1090, 1132, 1073, 1136, 1143, 1061, 1150, 1085, 1155, 1098, 1101, 1146, 1162, 1169, 1101, 1185, 1151, 1090, 1110, 1173, 1054, 1087, 1109, 1177, 1165, 1089, 1204, 1184, 1107, 1189, 1193, 1088, 1197, 1180, 1201, 1208, 1042, 1212, 1219, 1223, 1227, 1231, 1235, 1245, 1777, 1527, 1686, 1686, 1238, 1686, 1254, 1686, 1686, 1686, 1294, 1669, 1686, 1686, 1686, 1322, 1625, 1534, 1268, 1624, 1275, 1281, 1443, 1292, 1300, 1686, 1686, 1686, 1350, 1826, 1306, 1686, 1686, 1240, 2032, 1317, 1321, 1686, 1686, 1253, 1686, 1326, 1686, 1686, 1686, 1418, 1709, 1446, 1686, 1686, 1686, 1492, 1686, 1295, 1447, 1686, 1686, 1258, 1686, 1736, 1686, 1686, 1520, 1355, 1686, 1288, 1348, 1361, 1686, 1359, 1686, 1364, 1498, 1368, 1302, 1362, 1381, 1389, 1395, 1486, 1686, 1371, 1377, 1370, 1686, 1375, 1382, 1384, 1402, 1408, 1385, 1383, 1619, 1413, 1423, 1428, 1433, 1686, 1686, 1270, 1686, 1338, 1686, 1440, 1686, 1686, 1686, 1499, 1465, 1686, 1686, 1686, 1639, 1473, 1884, 1686, 1686, 1293, 1864, 1686, 1686, 1296, 1321, 1483, 1686, 1686, 1686, 1646, 1686, 1748, 1496, 1686, 1418, 1675, 1686, 1418, 1702, 1686, 1418, 1981, 1686, 1429, 1409, 1427, 1504, 1692, 1686, 1686, 1313, 1448, 1651, 1508, 1686, 1686, 1340, 1686, 1903, 1686, 1686, 1435, 1513, 1686, 1283, 1287, 1519, 1686, 1524, 1363, 1568, 1938, 1539, 1566, 1579, 1479, 1533, 1538, 1553, 1544, 1552, 1557, 1563, 1574, 1557, 1583, 1589, 1590, 1759, 1594, 1603, 1607, 1611, 1686, 1436, 1514, 1686, 1434, 1656, 1686, 1434, 1680, 1686, 1453, 1686, 1686, 1686, 1559, 1617, 1686, 1770, 1418, 1623, 1769, 1629, 1686, 1515, 1335, 1686, 1285, 1686, 1671, 1921, 1650, 1686, 1686, 1344, 1308, 1666, 1686, 1686, 1686, 1659, 1685, 1686, 1686, 1686, 1686, 1241, 1686, 1686, 1844, 1691, 1686, 1630, 1977, 1970, 1362, 1686, 1686, 1686, 1693, 1698, 1686, 1686, 1686, 1697, 1686, 1764, 1715, 1686, 1634, 1638, 1686, 1599, 1585, 1686, 1271, 1686, 1269, 1686, 1721, 1686, 1686, 1354, 1686, 1801, 1686, 1799, 1686, 1640, 1686, 1686, 1461, 1686, 1686, 1732, 1686, 1944, 1686, 1740, 1686, 1746, 1415, 1396, 1686, 1598, 1547, 1417, 1597, 1416, 1577, 1546, 1397, 1577, 1547, 1548, 1570, 1398, 1753, 1686, 1652, 1509, 1686, 1686, 1686, 1757, 1686, 1419, 1686, 1763, 1418, 1768, 1781, 1686, 1686, 1686, 1705, 1686, 2048
|
||
|
];
|
||
|
|
||
|
JSONiqTokenizer.TOKEN =
|
||
|
[
|
||
|
"(0)",
|
||
|
"ModuleDecl",
|
||
|
"Annotation",
|
||
|
"OptionDecl",
|
||
|
"Operator",
|
||
|
"Variable",
|
||
|
"Tag",
|
||
|
"EndTag",
|
||
|
"PragmaContents",
|
||
|
"DirCommentContents",
|
||
|
"DirPIContents",
|
||
|
"CDataSectionContents",
|
||
|
"AttrTest",
|
||
|
"Wildcard",
|
||
|
"EQName",
|
||
|
"IntegerLiteral",
|
||
|
"DecimalLiteral",
|
||
|
"DoubleLiteral",
|
||
|
"PredefinedEntityRef",
|
||
|
"'\"\"'",
|
||
|
"EscapeApos",
|
||
|
"QuotChar",
|
||
|
"AposChar",
|
||
|
"ElementContentChar",
|
||
|
"QuotAttrContentChar",
|
||
|
"AposAttrContentChar",
|
||
|
"NCName",
|
||
|
"QName",
|
||
|
"S",
|
||
|
"CharRef",
|
||
|
"CommentContents",
|
||
|
"DocTag",
|
||
|
"DocCommentContents",
|
||
|
"EOF",
|
||
|
"'!'",
|
||
|
"'\"'",
|
||
|
"'#'",
|
||
|
"'#)'",
|
||
|
"''''",
|
||
|
"'('",
|
||
|
"'(#'",
|
||
|
"'(:'",
|
||
|
"'(:~'",
|
||
|
"')'",
|
||
|
"'*'",
|
||
|
"'*'",
|
||
|
"','",
|
||
|
"'-->'",
|
||
|
"'.'",
|
||
|
"'/'",
|
||
|
"'/>'",
|
||
|
"':'",
|
||
|
"':)'",
|
||
|
"';'",
|
||
|
"'<!--'",
|
||
|
"'<![CDATA['",
|
||
|
"'<?'",
|
||
|
"'='",
|
||
|
"'>'",
|
||
|
"'?'",
|
||
|
"'?>'",
|
||
|
"'NaN'",
|
||
|
"'['",
|
||
|
"']'",
|
||
|
"']]>'",
|
||
|
"'after'",
|
||
|
"'all'",
|
||
|
"'allowing'",
|
||
|
"'ancestor'",
|
||
|
"'ancestor-or-self'",
|
||
|
"'and'",
|
||
|
"'any'",
|
||
|
"'append'",
|
||
|
"'array'",
|
||
|
"'as'",
|
||
|
"'ascending'",
|
||
|
"'at'",
|
||
|
"'attribute'",
|
||
|
"'base-uri'",
|
||
|
"'before'",
|
||
|
"'boundary-space'",
|
||
|
"'break'",
|
||
|
"'by'",
|
||
|
"'case'",
|
||
|
"'cast'",
|
||
|
"'castable'",
|
||
|
"'catch'",
|
||
|
"'check'",
|
||
|
"'child'",
|
||
|
"'collation'",
|
||
|
"'collection'",
|
||
|
"'comment'",
|
||
|
"'constraint'",
|
||
|
"'construction'",
|
||
|
"'contains'",
|
||
|
"'content'",
|
||
|
"'context'",
|
||
|
"'continue'",
|
||
|
"'copy'",
|
||
|
"'copy-namespaces'",
|
||
|
"'count'",
|
||
|
"'decimal-format'",
|
||
|
"'decimal-separator'",
|
||
|
"'declare'",
|
||
|
"'default'",
|
||
|
"'delete'",
|
||
|
"'descendant'",
|
||
|
"'descendant-or-self'",
|
||
|
"'descending'",
|
||
|
"'diacritics'",
|
||
|
"'different'",
|
||
|
"'digit'",
|
||
|
"'distance'",
|
||
|
"'div'",
|
||
|
"'document'",
|
||
|
"'document-node'",
|
||
|
"'element'",
|
||
|
"'else'",
|
||
|
"'empty'",
|
||
|
"'empty-sequence'",
|
||
|
"'encoding'",
|
||
|
"'end'",
|
||
|
"'entire'",
|
||
|
"'eq'",
|
||
|
"'every'",
|
||
|
"'exactly'",
|
||
|
"'except'",
|
||
|
"'exit'",
|
||
|
"'external'",
|
||
|
"'first'",
|
||
|
"'following'",
|
||
|
"'following-sibling'",
|
||
|
"'for'",
|
||
|
"'foreach'",
|
||
|
"'foreign'",
|
||
|
"'from'",
|
||
|
"'ft-option'",
|
||
|
"'ftand'",
|
||
|
"'ftnot'",
|
||
|
"'ftor'",
|
||
|
"'function'",
|
||
|
"'ge'",
|
||
|
"'greatest'",
|
||
|
"'group'",
|
||
|
"'grouping-separator'",
|
||
|
"'gt'",
|
||
|
"'idiv'",
|
||
|
"'if'",
|
||
|
"'import'",
|
||
|
"'in'",
|
||
|
"'index'",
|
||
|
"'infinity'",
|
||
|
"'inherit'",
|
||
|
"'insensitive'",
|
||
|
"'insert'",
|
||
|
"'instance'",
|
||
|
"'integrity'",
|
||
|
"'intersect'",
|
||
|
"'into'",
|
||
|
"'is'",
|
||
|
"'item'",
|
||
|
"'json'",
|
||
|
"'json-item'",
|
||
|
"'key'",
|
||
|
"'language'",
|
||
|
"'last'",
|
||
|
"'lax'",
|
||
|
"'le'",
|
||
|
"'least'",
|
||
|
"'let'",
|
||
|
"'levels'",
|
||
|
"'loop'",
|
||
|
"'lowercase'",
|
||
|
"'lt'",
|
||
|
"'minus-sign'",
|
||
|
"'mod'",
|
||
|
"'modify'",
|
||
|
"'module'",
|
||
|
"'most'",
|
||
|
"'namespace'",
|
||
|
"'namespace-node'",
|
||
|
"'ne'",
|
||
|
"'next'",
|
||
|
"'no'",
|
||
|
"'no-inherit'",
|
||
|
"'no-preserve'",
|
||
|
"'node'",
|
||
|
"'nodes'",
|
||
|
"'not'",
|
||
|
"'object'",
|
||
|
"'occurs'",
|
||
|
"'of'",
|
||
|
"'on'",
|
||
|
"'only'",
|
||
|
"'option'",
|
||
|
"'or'",
|
||
|
"'order'",
|
||
|
"'ordered'",
|
||
|
"'ordering'",
|
||
|
"'paragraph'",
|
||
|
"'paragraphs'",
|
||
|
"'parent'",
|
||
|
"'pattern-separator'",
|
||
|
"'per-mille'",
|
||
|
"'percent'",
|
||
|
"'phrase'",
|
||
|
"'position'",
|
||
|
"'preceding'",
|
||
|
"'preceding-sibling'",
|
||
|
"'preserve'",
|
||
|
"'previous'",
|
||
|
"'processing-instruction'",
|
||
|
"'relationship'",
|
||
|
"'rename'",
|
||
|
"'replace'",
|
||
|
"'return'",
|
||
|
"'returning'",
|
||
|
"'revalidation'",
|
||
|
"'same'",
|
||
|
"'satisfies'",
|
||
|
"'schema'",
|
||
|
"'schema-attribute'",
|
||
|
"'schema-element'",
|
||
|
"'score'",
|
||
|
"'self'",
|
||
|
"'sensitive'",
|
||
|
"'sentence'",
|
||
|
"'sentences'",
|
||
|
"'skip'",
|
||
|
"'sliding'",
|
||
|
"'some'",
|
||
|
"'stable'",
|
||
|
"'start'",
|
||
|
"'stemming'",
|
||
|
"'stop'",
|
||
|
"'strict'",
|
||
|
"'strip'",
|
||
|
"'structured-item'",
|
||
|
"'switch'",
|
||
|
"'text'",
|
||
|
"'then'",
|
||
|
"'thesaurus'",
|
||
|
"'times'",
|
||
|
"'to'",
|
||
|
"'treat'",
|
||
|
"'try'",
|
||
|
"'tumbling'",
|
||
|
"'type'",
|
||
|
"'typeswitch'",
|
||
|
"'union'",
|
||
|
"'unique'",
|
||
|
"'unordered'",
|
||
|
"'updating'",
|
||
|
"'uppercase'",
|
||
|
"'using'",
|
||
|
"'validate'",
|
||
|
"'value'",
|
||
|
"'variable'",
|
||
|
"'version'",
|
||
|
"'weight'",
|
||
|
"'when'",
|
||
|
"'where'",
|
||
|
"'while'",
|
||
|
"'wildcards'",
|
||
|
"'window'",
|
||
|
"'with'",
|
||
|
"'without'",
|
||
|
"'word'",
|
||
|
"'words'",
|
||
|
"'xquery'",
|
||
|
"'zero-digit'",
|
||
|
"'{'",
|
||
|
"'{{'",
|
||
|
"'|'",
|
||
|
"'}'",
|
||
|
"'}}'"
|
||
|
];
|
||
|
});
|
||
|
ace.define('ace/mode/behaviour/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/mode/behaviour/xml', 'ace/token_iterator'], function(require, exports, module) {
|
||
|
|
||
|
|
||
|
var oop = require("../../lib/oop");
|
||
|
var Behaviour = require('../behaviour').Behaviour;
|
||
|
var CstyleBehaviour = require('./cstyle').CstyleBehaviour;
|
||
|
var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
|
||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||
|
|
||
|
function hasType(token, type) {
|
||
|
var hasType = true;
|
||
|
var typeList = token.type.split('.');
|
||
|
var needleList = type.split('.');
|
||
|
needleList.forEach(function(needle){
|
||
|
if (typeList.indexOf(needle) == -1) {
|
||
|
hasType = false;
|
||
|
return false;
|
||
|
}
|
||
|
});
|
||
|
return hasType;
|
||
|
}
|
||
|
|
||
|
var XQueryBehaviour = function () {
|
||
|
|
||
|
this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
|
||
|
this.inherit(XmlBehaviour); // Get xml behaviour
|
||
|
|
||
|
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
|
||
|
if (text == '>') {
|
||
|
var position = editor.getCursorPosition();
|
||
|
var iterator = new TokenIterator(session, position.row, position.column);
|
||
|
var token = iterator.getCurrentToken();
|
||
|
var atCursor = false;
|
||
|
var state = JSON.parse(state).pop();
|
||
|
if ((token && token.value === '>') || state !== "StartTag") return;
|
||
|
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
||
|
do {
|
||
|
token = iterator.stepBackward();
|
||
|
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
|
||
|
} else {
|
||
|
atCursor = true;
|
||
|
}
|
||
|
var previous = iterator.stepBackward();
|
||
|
if (!token || !hasType(token, 'meta.tag') || (previous !== null && previous.value.match('/'))) {
|
||
|
return
|
||
|
}
|
||
|
var tag = token.value.substring(1);
|
||
|
if (atCursor){
|
||
|
var tag = tag.substring(0, position.column - token.start);
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
text: '>' + '</' + tag + '>',
|
||
|
selection: [1, 1]
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
oop.inherits(XQueryBehaviour, Behaviour);
|
||
|
|
||
|
exports.XQueryBehaviour = XQueryBehaviour;
|
||
|
});
|
||
|
|
||
|
ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
||
|
|
||
|
|
||
|
var oop = require("../../lib/oop");
|
||
|
var Behaviour = require("../behaviour").Behaviour;
|
||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||
|
var lang = require("../../lib/lang");
|
||
|
|
||
|
var SAFE_INSERT_IN_TOKENS =
|
||
|
["text", "paren.rparen", "punctuation.operator"];
|
||
|
var SAFE_INSERT_BEFORE_TOKENS =
|
||
|
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||
|
|
||
|
|
||
|
var autoInsertedBrackets = 0;
|
||
|
var autoInsertedRow = -1;
|
||
|
var autoInsertedLineEnd = "";
|
||
|
var maybeInsertedBrackets = 0;
|
||
|
var maybeInsertedRow = -1;
|
||
|
var maybeInsertedLineStart = "";
|
||
|
var maybeInsertedLineEnd = "";
|
||
|
|
||
|
var CstyleBehaviour = function () {
|
||
|
|
||
|
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||
|
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||
|
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||
|
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||
|
return false;
|
||
|
}
|
||
|
iterator.stepForward();
|
||
|
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||
|
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.$matchTokenType = function(token, types) {
|
||
|
return types.indexOf(token.type || token) > -1;
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.doc.getLine(cursor.row);
|
||
|
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
||
|
autoInsertedBrackets = 0;
|
||
|
autoInsertedRow = cursor.row;
|
||
|
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||
|
autoInsertedBrackets++;
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.doc.getLine(cursor.row);
|
||
|
if (!this.isMaybeInsertedClosing(cursor, line))
|
||
|
maybeInsertedBrackets = 0;
|
||
|
maybeInsertedRow = cursor.row;
|
||
|
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
||
|
maybeInsertedLineEnd = line.substr(cursor.column);
|
||
|
maybeInsertedBrackets++;
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||
|
return autoInsertedBrackets > 0 &&
|
||
|
cursor.row === autoInsertedRow &&
|
||
|
bracket === autoInsertedLineEnd[0] &&
|
||
|
line.substr(cursor.column) === autoInsertedLineEnd;
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
||
|
return maybeInsertedBrackets > 0 &&
|
||
|
cursor.row === maybeInsertedRow &&
|
||
|
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
||
|
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.popAutoInsertedClosing = function() {
|
||
|
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
||
|
autoInsertedBrackets--;
|
||
|
};
|
||
|
|
||
|
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
||
|
maybeInsertedBrackets = 0;
|
||
|
maybeInsertedRow = -1;
|
||
|
};
|
||
|
|
||
|
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.doc.getLine(cursor.row);
|
||
|
if (text == '{') {
|
||
|
var selection = editor.getSelectionRange();
|
||
|
var selected = session.doc.getTextRange(selection);
|
||
|
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
||
|
return {
|
||
|
text: '{' + selected + '}',
|
||
|
selection: false
|
||
|
};
|
||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||
|
if (/[\]\}\)]/.test(line[cursor.column])) {
|
||
|
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||
|
return {
|
||
|
text: '{}',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
} else {
|
||
|
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
||
|
return {
|
||
|
text: '{',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
} else if (text == '}') {
|
||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||
|
if (rightChar == '}') {
|
||
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||
|
return {
|
||
|
text: '',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
} else if (text == "\n" || text == "\r\n") {
|
||
|
var closing = "";
|
||
|
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
||
|
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
||
|
CstyleBehaviour.clearMaybeInsertedClosing();
|
||
|
}
|
||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||
|
if (rightChar == '}' || closing !== "") {
|
||
|
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
|
||
|
if (!openBracePos)
|
||
|
return null;
|
||
|
|
||
|
var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
|
||
|
var next_indent = this.$getIndent(line);
|
||
|
|
||
|
return {
|
||
|
text: '\n' + indent + '\n' + next_indent + closing,
|
||
|
selection: [1, indent.length, 1, indent.length]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("braces", "deletion", function (state, action, editor, session, range) {
|
||
|
var selected = session.doc.getTextRange(range);
|
||
|
if (!range.isMultiLine() && selected == '{') {
|
||
|
var line = session.doc.getLine(range.start.row);
|
||
|
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||
|
if (rightChar == '}') {
|
||
|
range.end.column++;
|
||
|
return range;
|
||
|
} else {
|
||
|
maybeInsertedBrackets--;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("parens", "insertion", function (state, action, editor, session, text) {
|
||
|
if (text == '(') {
|
||
|
var selection = editor.getSelectionRange();
|
||
|
var selected = session.doc.getTextRange(selection);
|
||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||
|
return {
|
||
|
text: '(' + selected + ')',
|
||
|
selection: false
|
||
|
};
|
||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||
|
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||
|
return {
|
||
|
text: '()',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
} else if (text == ')') {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.doc.getLine(cursor.row);
|
||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||
|
if (rightChar == ')') {
|
||
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||
|
return {
|
||
|
text: '',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("parens", "deletion", function (state, action, editor, session, range) {
|
||
|
var selected = session.doc.getTextRange(range);
|
||
|
if (!range.isMultiLine() && selected == '(') {
|
||
|
var line = session.doc.getLine(range.start.row);
|
||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||
|
if (rightChar == ')') {
|
||
|
range.end.column++;
|
||
|
return range;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
||
|
if (text == '[') {
|
||
|
var selection = editor.getSelectionRange();
|
||
|
var selected = session.doc.getTextRange(selection);
|
||
|
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||
|
return {
|
||
|
text: '[' + selected + ']',
|
||
|
selection: false
|
||
|
};
|
||
|
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||
|
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||
|
return {
|
||
|
text: '[]',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
} else if (text == ']') {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.doc.getLine(cursor.row);
|
||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||
|
if (rightChar == ']') {
|
||
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||
|
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||
|
CstyleBehaviour.popAutoInsertedClosing();
|
||
|
return {
|
||
|
text: '',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("brackets", "deletion", function (state, action, editor, session, range) {
|
||
|
var selected = session.doc.getTextRange(range);
|
||
|
if (!range.isMultiLine() && selected == '[') {
|
||
|
var line = session.doc.getLine(range.start.row);
|
||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||
|
if (rightChar == ']') {
|
||
|
range.end.column++;
|
||
|
return range;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||
|
if (text == '"' || text == "'") {
|
||
|
var quote = text;
|
||
|
var selection = editor.getSelectionRange();
|
||
|
var selected = session.doc.getTextRange(selection);
|
||
|
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
||
|
return {
|
||
|
text: quote + selected + quote,
|
||
|
selection: false
|
||
|
};
|
||
|
} else {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.doc.getLine(cursor.row);
|
||
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||
|
if (leftChar == '\\') {
|
||
|
return null;
|
||
|
}
|
||
|
var tokens = session.getTokens(selection.start.row);
|
||
|
var col = 0, token;
|
||
|
var quotepos = -1; // Track whether we're inside an open quote.
|
||
|
|
||
|
for (var x = 0; x < tokens.length; x++) {
|
||
|
token = tokens[x];
|
||
|
if (token.type == "string") {
|
||
|
quotepos = -1;
|
||
|
} else if (quotepos < 0) {
|
||
|
quotepos = token.value.indexOf(quote);
|
||
|
}
|
||
|
if ((token.value.length + col) > selection.start.column) {
|
||
|
break;
|
||
|
}
|
||
|
col += tokens[x].value.length;
|
||
|
}
|
||
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||
|
return;
|
||
|
return {
|
||
|
text: quote + quote,
|
||
|
selection: [1,1]
|
||
|
};
|
||
|
} else if (token && token.type === "string") {
|
||
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||
|
if (rightChar == quote) {
|
||
|
return {
|
||
|
text: '',
|
||
|
selection: [1, 1]
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||
|
var selected = session.doc.getTextRange(range);
|
||
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||
|
var line = session.doc.getLine(range.start.row);
|
||
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||
|
if (rightChar == selected) {
|
||
|
range.end.column++;
|
||
|
return range;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
};
|
||
|
|
||
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||
|
|
||
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||
|
});
|
||
|
|
||
|
ace.define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
|
||
|
|
||
|
|
||
|
var oop = require("../../lib/oop");
|
||
|
var Behaviour = require("../behaviour").Behaviour;
|
||
|
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||
|
|
||
|
function hasType(token, type) {
|
||
|
var tokenTypes = token.type.split('.');
|
||
|
return type.split('.').every(function(type){
|
||
|
return (tokenTypes.indexOf(type) !== -1);
|
||
|
});
|
||
|
return hasType;
|
||
|
}
|
||
|
|
||
|
var XmlBehaviour = function () {
|
||
|
|
||
|
this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
|
||
|
|
||
|
this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
|
||
|
if (text == '>') {
|
||
|
var position = editor.getCursorPosition();
|
||
|
var iterator = new TokenIterator(session, position.row, position.column);
|
||
|
var token = iterator.getCurrentToken();
|
||
|
|
||
|
if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
|
||
|
return;
|
||
|
var atCursor = false;
|
||
|
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
||
|
do {
|
||
|
token = iterator.stepBackward();
|
||
|
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
|
||
|
} else {
|
||
|
atCursor = true;
|
||
|
}
|
||
|
if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
|
||
|
return;
|
||
|
}
|
||
|
var tag = token.value;
|
||
|
if (atCursor){
|
||
|
var tag = tag.substring(0, position.column - token.start);
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
text: '>' + '</' + tag + '>',
|
||
|
selection: [1, 1]
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
|
||
|
if (text == "\n") {
|
||
|
var cursor = editor.getCursorPosition();
|
||
|
var line = session.getLine(cursor.row);
|
||
|
var rightChars = line.substring(cursor.column, cursor.column + 2);
|
||
|
if (rightChars == '</') {
|
||
|
var next_indent = this.$getIndent(line);
|
||
|
var indent = next_indent + session.getTabString();
|
||
|
|
||
|
return {
|
||
|
text: '\n' + indent + '\n' + next_indent,
|
||
|
selection: [1, indent.length, 1, indent.length]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
oop.inherits(XmlBehaviour, Behaviour);
|
||
|
|
||
|
exports.XmlBehaviour = XmlBehaviour;
|
||
|
});
|
||
|
|
||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||
|
|
||
|
|
||
|
var oop = require("../../lib/oop");
|
||
|
var Range = require("../../range").Range;
|
||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||
|
|
||
|
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||
|
if (commentRegex) {
|
||
|
this.foldingStartMarker = new RegExp(
|
||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||
|
);
|
||
|
this.foldingStopMarker = new RegExp(
|
||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||
|
);
|
||
|
}
|
||
|
};
|
||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||
|
|
||
|
(function() {
|
||
|
|
||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||
|
|
||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||
|
var line = session.getLine(row);
|
||
|
var match = line.match(this.foldingStartMarker);
|
||
|
if (match) {
|
||
|
var i = match.index;
|
||
|
|
||
|
if (match[1])
|
||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||
|
|
||
|
return session.getCommentFoldRange(row, i + match[0].length, 1);
|
||
|
}
|
||
|
|
||
|
if (foldStyle !== "markbeginend")
|
||
|
return;
|
||
|
|
||
|
var match = line.match(this.foldingStopMarker);
|
||
|
if (match) {
|
||
|
var i = match.index + match[0].length;
|
||
|
|
||
|
if (match[1])
|
||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||
|
|
||
|
return session.getCommentFoldRange(row, i, -1);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
}).call(FoldMode.prototype);
|
||
|
|
||
|
});
|