Add JSONiq mode.

This commit is contained in:
William Candillon 2013-04-10 15:09:51 +02:00 committed by nightwing
commit e099044630
6 changed files with 5159 additions and 1 deletions

View file

@ -106,6 +106,7 @@ var modesByName = {
velocity: ["Velocity" , "vm"],
xml: ["XML" , "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
xquery: ["XQuery" , "xq"],
jsoniq: ["JSONiq" , "jq"],
yaml: ["YAML" , "yaml"]
};

106
lib/ace/mode/jsoniq.js Normal file
View file

@ -0,0 +1,106 @@
/* ***** 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 ***** */
define(function(require, exports, module) {
"use strict";
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;
});

View file

@ -39,7 +39,7 @@ var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function(parent) {
var Mode = function() {
this.$tokenizer = new XQueryLexer();
this.$behaviour = new XQueryBehaviour();
this.foldingRules = new CStyleFoldMode();

View file

@ -0,0 +1,302 @@
/* ***** 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 ***** */
define(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;
}
};
});

View file

@ -0,0 +1,544 @@
<?xqlint
/* ***** 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 ***** */
define(function(require, exports, module){
var JSONiqTokenizer = exports.JSONiqTokenizer = function JSONiqTokenizer(string, parsingEventHandler)
{
init(string, parsingEventHandler);
?>
start ::= '<![CDATA['
| '<!--'
| '<?'
| '(#'
| '(:~'
| '(:'
| '"'
| "'"
| "}"
| "{"
| "("
| ")"
| "/"
| "["
| "]"
| ","
| "."
| ";"
| ":"
| "!"
| "|"
| Annotation
| ModuleDecl
| OptionDecl
| AttrTest
| Wildcard
| IntegerLiteral
| DecimalLiteral
| DoubleLiteral
| Variable
| EQName
| Tag
| Operator
| EOF
StartTag ::= '>' | '/>' | QName | "=" | '"' | "'" | EOF
TagContent
::= ElementContentChar | Tag | EndTag | '<![CDATA[' | '<!--' | PredefinedEntityRef | CharRef | '{{' | '}}' | '{' | EOF
/* ws: explicit */
AposAttr
::= EscapeApos | AposAttrContentChar | PredefinedEntityRef | CharRef | '{{' | '}}' | '{' | "'" | EOF
/* ws: explicit */
QuotAttr
::= EscapeQuot | QuotAttrContentChar | PredefinedEntityRef | CharRef | '{{' | '}}' | '{' | '"' | EOF
/* ws: explicit */
CData ::= CDataSectionContents | ']]>' | EOF
/* ws: explicit */
XMLComment
::= DirCommentContents | '-->' | EOF
/* ws: explicit */
PI ::= DirPIContents | '?' | '?>' | EOF
/* ws: explicit */
Pragma ::= PragmaContents | '#' | '#)' | EOF
/* ws: explicit */
Comment ::= ':)' | '(:' | CommentContents | EOF
/* ws: explicit */
CommentDoc
::= DocTag | DocCommentContents | ':)' | '(:' | EOF
/* ws: explicit */
QuotString
::= PredefinedEntityRef | CharRef | EscapeQuot | QuotChar | '"' | EOF
/* ws: explicit */
AposString
::= PredefinedEntityRef | CharRef | EscapeApos | AposChar | "'" | EOF
/* ws: explicit */
Prefix ::= NCName
_EQName ::= EQName
Whitespace
::= S^WS
/* ws: definition */
EQName ::= FunctionName
| 'attribute'
| 'comment'
| 'document-node'
| 'element'
| 'empty-sequence'
| 'function'
| 'if'
| 'item'
| 'namespace-node'
| 'node'
| 'processing-instruction'
| 'schema-attribute'
| 'schema-element'
| 'switch'
| 'text'
| 'typeswitch'
FunctionName
::= EQName^Token
| 'after'
| 'ancestor'
| 'ancestor-or-self'
| 'and'
| 'as'
| 'ascending'
| 'before'
| 'case'
| 'cast'
| 'castable'
| 'child'
| 'collation'
| 'copy'
| 'count'
| 'declare'
| 'default'
| 'delete'
| 'descendant'
| 'descendant-or-self'
| 'descending'
| 'div'
| 'document'
| 'else'
| 'empty'
| 'end'
| 'eq'
| 'every'
| 'except'
| 'first'
| 'following'
| 'following-sibling'
| 'for'
| 'ge'
| 'group'
| 'gt'
| 'idiv'
| 'import'
| 'insert'
| 'instance'
| 'intersect'
| 'into'
| 'is'
| 'last'
| 'le'
| 'let'
| 'lt'
| 'mod'
| 'modify'
| 'module'
| 'namespace'
| 'ne'
| 'only'
| 'or'
| 'order'
| 'ordered'
| 'parent'
| 'preceding'
| 'preceding-sibling'
| 'rename'
| 'replace'
| 'return'
| 'satisfies'
| 'self'
| 'some'
| 'stable'
| 'start'
| 'to'
| 'treat'
| 'try'
| 'union'
| 'unordered'
| 'validate'
| 'where'
| 'with'
| 'xquery'
| 'allowing'
| 'at'
| 'base-uri'
| 'boundary-space'
| 'break'
| 'catch'
| 'construction'
| 'context'
| 'continue'
| 'copy-namespaces'
| 'decimal-format'
| 'encoding'
| 'exit'
| 'external'
| 'ft-option'
| 'in'
| 'index'
| 'integrity'
| 'lax'
| 'nodes'
| 'option'
| 'ordering'
| 'revalidation'
| 'schema'
| 'score'
| 'sliding'
| 'strict'
| 'tumbling'
| 'type'
| 'updating'
| 'value'
| 'variable'
| 'version'
| 'while'
| 'constraint'
| 'loop'
| 'returning'
NCName ::= NCName^Token
| 'after'
| 'and'
| 'as'
| 'ascending'
| 'before'
| 'case'
| 'cast'
| 'castable'
| 'collation'
| 'count'
| 'default'
| 'descending'
| 'div'
| 'else'
| 'empty'
| 'end'
| 'eq'
| 'except'
| 'for'
| 'ge'
| 'group'
| 'gt'
| 'idiv'
| 'instance'
| 'intersect'
| 'into'
| 'is'
| 'le'
| 'let'
| 'lt'
| 'mod'
| 'modify'
| 'ne'
| 'only'
| 'or'
| 'order'
| 'return'
| 'satisfies'
| 'stable'
| 'start'
| 'to'
| 'treat'
| 'union'
| 'where'
| 'with'
| 'ancestor'
| 'ancestor-or-self'
| 'attribute'
| 'child'
| 'comment'
| 'copy'
| 'declare'
| 'delete'
| 'descendant'
| 'descendant-or-self'
| 'document'
| 'document-node'
| 'element'
| 'empty-sequence'
| 'every'
| 'first'
| 'following'
| 'following-sibling'
| 'function'
| 'if'
| 'import'
| 'insert'
| 'item'
| 'last'
| 'module'
| 'namespace'
| 'namespace-node'
| 'node'
| 'ordered'
| 'parent'
| 'preceding'
| 'preceding-sibling'
| 'processing-instruction'
| 'rename'
| 'replace'
| 'schema-attribute'
| 'schema-element'
| 'self'
| 'some'
| 'switch'
| 'text'
| 'try'
| 'typeswitch'
| 'unordered'
| 'validate'
| 'variable'
| 'xquery'
| 'allowing'
| 'at'
| 'base-uri'
| 'boundary-space'
| 'break'
| 'catch'
| 'construction'
| 'context'
| 'continue'
| 'copy-namespaces'
| 'decimal-format'
| 'encoding'
| 'exit'
| 'external'
| 'ft-option'
| 'in'
| 'index'
| 'integrity'
| 'lax'
| 'nodes'
| 'option'
| 'ordering'
| 'revalidation'
| 'schema'
| 'score'
| 'sliding'
| 'strict'
| 'tumbling'
| 'type'
| 'updating'
| 'value'
| 'version'
| 'while'
| 'constraint'
| 'loop'
| 'returning'
<?TOKENS?>
ModuleDecl
::= ('import' S)? ('module' | 'schema') S 'namespace'
Annotation
::= '%' EQName ?
OptionDecl
::= 'declare' S ( ( 'decimal-format' | 'option' )
| ('default' S 'decimal-format') )
Operator ::= '!=' | ':=' | '>=' | '<=' | '=' | '<' | '>' | '-' | '+' | 'div' | '||' | '?'
Variable ::= '$' EQName
Tag ::= '<' QName
EndTag ::= '</' QName S? '>'
PragmaContents
::= ( Char* - ( Char* '#' Char* ) )+
DirCommentContents
::= ( ( Char - '-' ) | '-' ( Char - '-' ) )+
DirPIContents
::= ( Char* - ( Char* '?' Char* ) )+
CDataSectionContents
::= ( Char+ - ( Char* ']]>' Char* ) ) & ']]'
| ( Char+ - ( Char* ']]>' Char* ) ) & $
AttrTest ::= "@" ( Wildcard | QName )
Wildcard ::= "*"
| (NCName ":" "*")
| ("*" ":" NCName)
| (BracedURILiteral "*")
EQName ::= QName
| URIQualifiedName
URIQualifiedName
::= BracedURILiteral NCName
BracedURILiteral
::= 'Q' '{' (PredefinedEntityRef | CharRef | [^&{}] )* '}'
URILiteral
::= StringLiteral
IntegerLiteral
::= Digits
DecimalLiteral
::= '.' Digits
| Digits '.' [0-9]*
/* ws: explicit */
DoubleLiteral
::= ( '.' Digits | Digits ( '.' [0-9]* )? ) [Ee] [+#x002D]? Digits
/* ws: explicit */
PredefinedEntityRef
::= '&' ( 'lt' | 'gt' | 'amp' | 'quot' | 'apos' ) ';'
/* ws: explicit */
EscapeQuot
::= '""'
EscapeApos
::= "''"
QuotChar ::= (Char - ["&])+
AposChar ::= (Char - [&'])+
ElementContentChar
::= (Char - [&<{}])+
QuotAttrContentChar
::= (Char - ["&<{}])+
AposAttrContentChar
::= (Char - [&'<{}])+
PITarget ::= NCName - ( ( 'X' | 'x' ) ( 'M' | 'm' ) ( 'L' | 'l' ) )
Name ::= NameStartChar NameChar*
NameStartChar
::= [:A-Z_a-z#x00C0-#x00D6#x00D8-#x00F6#x00F8-#x02FF#x0370-#x037D#x037F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD#x10000-#xEFFFF]
NameChar ::= NameStartChar
| [-.0-9#x00B7#x0300-#x036F#x203F-#x2040]
NCName ::= Name - ( Char* (':' | '.') Char* )
Char ::= [#x0009#x000A#x000D#x0020-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
QName ::= PrefixedName
| UnprefixedName
PrefixedName
::= Prefix ':' LocalPart
UnprefixedName
::= LocalPart
Prefix ::= NCName
LocalPart
::= NCName
S ::= [#x0009#x000A#x000D#x0020]+
CharRef ::= '&#' [0-9]+ ';'
| '&#x' [0-9A-Fa-f]+ ';'
Digits ::= [0-9]+
CommentContents
::= ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) & '(:'
| ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) & $
| ( ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) - ( Char* '(' ) ) & ':'
DocTag ::= ' @' NCName?
DocCommentContents
::= ( ( Char+ - ( Char* ( '(:' | ':)' | ' @' ) Char* ) ) - ( Char* '(' ) ) & ':'
| ( Char+ - ( Char* ( '(:' | ':)' | ' @' ) Char* ) ) & '(:'
| ( Char+ - ( Char* ( '(:' | ':)' | ' @' ) Char* ) ) & ' @'
| ( Char+ - ( Char* ( '(:' | ':)' | ' @') Char* ) ) & $
EOF ::= $
NonNCNameChar
::= $
| ':'
| '.'
| ( Char - NameChar )
DelimitingChar
::= NonNCNameChar
| '-'
| '.'
DelimitingChar
\\ IntegerLiteral DecimalLiteral DoubleLiteral
NonNCNameChar
\\ EQName^Token QName NCName^Token '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'
'*' << Wildcard '*'^OccurrenceIndicator
EQName^Token
<< 'after' 'ancestor' 'ancestor-or-self' 'and' 'as' 'ascending' 'attribute' 'before' 'case' 'cast' 'castable' 'child' 'collation' 'comment' 'copy' 'count' 'declare' 'default' 'delete' 'descendant' 'descendant-or-self' 'descending' 'div' 'document' 'document-node' 'element' 'else' 'empty' 'empty-sequence' 'end' 'eq' 'every' 'except' 'first' 'following' 'following-sibling' 'for' 'function' 'ge' 'group' 'gt' 'idiv' 'if' 'import' 'insert' 'instance' 'intersect' 'into' 'is' 'item' 'last' 'le' 'let' 'lt' 'mod' 'modify' 'module' 'namespace' 'namespace-node' 'ne' 'node' 'only' 'or' 'order' 'ordered' 'parent' 'preceding' 'preceding-sibling' 'processing-instruction' 'rename' 'replace' 'return' 'satisfies' 'schema-attribute' 'schema-element' 'self' 'some' 'stable' 'start' 'switch' 'text' 'to' 'treat' 'try' 'typeswitch' 'union' 'unordered' 'validate' 'where' 'with' 'xquery' 'contains' 'paragraphs' 'sentences' 'times' 'words' 'by' 'collection' 'allowing' 'at' 'base-uri' 'boundary-space' 'break' 'catch' 'construction' 'context' 'continue' 'copy-namespaces' 'decimal-format' 'encoding' 'exit' 'external' 'ft-option' 'in' 'index' 'integrity' 'lax' 'nodes' 'option' 'ordering' 'revalidation' 'schema' 'score' 'sliding' 'strict' 'tumbling' 'type' 'updating' 'value' 'variable' 'version' 'while' 'constraint' 'loop' 'returning' 'append' 'array' 'json-item' 'object' 'structured-item'
NCName^Token
<< 'after' 'and' 'as' 'ascending' 'before' 'case' 'cast' 'castable' 'collation' 'count' 'default' 'descending' 'div' 'else' 'empty' 'end' 'eq' 'except' 'for' 'ge' 'group' 'gt' 'idiv' 'instance' 'intersect' 'into' 'is' 'le' 'let' 'lt' 'mod' 'modify' 'ne' 'only' 'or' 'order' 'return' 'satisfies' 'stable' 'start' 'to' 'treat' 'union' 'where' 'with' 'contains' 'paragraphs' 'sentences' 'times' 'words' 'by' 'ancestor' 'ancestor-or-self' 'attribute' 'child' 'comment' 'copy' 'declare' 'delete' 'descendant' 'descendant-or-self' 'document' 'document-node' 'element' 'empty-sequence' 'every' 'first' 'following' 'following-sibling' 'function' 'if' 'import' 'insert' 'item' 'last' 'module' 'namespace' 'namespace-node' 'node' 'ordered' 'parent' 'preceding' 'preceding-sibling' 'processing-instruction' 'rename' 'replace' 'schema-attribute' 'schema-element' 'self' 'some' 'switch' 'text' 'try' 'typeswitch' 'unordered' 'validate' 'variable' 'xquery' 'allowing' 'at' 'base-uri' 'boundary-space' 'break' 'catch' 'construction' 'context' 'continue' 'copy-namespaces' 'decimal-format' 'encoding' 'exit' 'external' 'ft-option' 'in' 'index' 'integrity' 'lax' 'nodes' 'option' 'ordering' 'revalidation' 'schema' 'score' 'sliding' 'strict' 'tumbling' 'type' 'updating' 'value' 'version' 'while' 'constraint' 'loop' 'returning'
<?ENCORE?>
<?xqlint
});
?>

File diff suppressed because it is too large Load diff