commit
dc5db8b859
8 changed files with 37716 additions and 37520 deletions
|
|
@ -60,6 +60,8 @@ function hasType(token, type) {
|
|||
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();
|
||||
|
|
|
|||
|
|
@ -112,20 +112,12 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
this.$deltas = [];
|
||||
var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker");
|
||||
|
||||
var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker");
|
||||
var that = this;
|
||||
|
||||
session.getDocument().on('change', function(evt){
|
||||
that.$deltas.push(evt.data);
|
||||
});
|
||||
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("start", function(e) {
|
||||
that.$deltas = [];
|
||||
});
|
||||
|
||||
worker.on("error", function(e) {
|
||||
session.setAnnotations([e.data]);
|
||||
});
|
||||
|
|
@ -135,15 +127,14 @@ oop.inherits(Mode, TextMode);
|
|||
});
|
||||
|
||||
worker.on("highlight", function(tokens) {
|
||||
if(that.$deltas.length > 0) return;
|
||||
that.$tokenizer.tokens = tokens.data.tokens;
|
||||
that.$tokenizer.lines = session.getDocument().getAllLines();
|
||||
session.bgTokenizer.lines = [];
|
||||
session.bgTokenizer.states = [];
|
||||
|
||||
var rows = Object.keys(that.$tokenizer.tokens);
|
||||
for(var i=0; i < rows.length; i++) {
|
||||
var row = parseInt(rows[i]);
|
||||
delete session.bgTokenizer.lines[row];
|
||||
delete session.bgTokenizer.states[row];
|
||||
session.bgTokenizer.fireUpdateEvent(row, row);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ define(function(require, exports, module){
|
|||
}
|
||||
}
|
||||
|
||||
function popNode(name, end){
|
||||
function popNode(){
|
||||
|
||||
if(ptr.children.length > 0) {
|
||||
var s = ptr.children[0];
|
||||
|
|
@ -111,7 +111,14 @@ define(function(require, exports, module){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.closeParseTree = function() {
|
||||
while(ptr.getParent !== null) {
|
||||
popNode();
|
||||
}
|
||||
popNode();
|
||||
};
|
||||
|
||||
this.peek = function() {
|
||||
return ptr;
|
||||
};
|
||||
|
|
@ -127,21 +134,21 @@ define(function(require, exports, module){
|
|||
};
|
||||
|
||||
this.endNonterminal = function(name, end) {
|
||||
popNode(name, end);
|
||||
popNode();
|
||||
};
|
||||
|
||||
this.terminal = function(name, begin, end) {
|
||||
name = (name.substring(0, 1) === "'" && name.substring(name.length - 1) === "'") ? "TOKEN" : name;
|
||||
pushNode(name, begin);
|
||||
setValue(ptr, begin, end);
|
||||
popNode(name, end);
|
||||
popNode();
|
||||
};
|
||||
|
||||
this.whitespace = function(begin, end) {
|
||||
var name = "WS";
|
||||
pushNode(name, begin);
|
||||
setValue(ptr, begin, end);
|
||||
popNode(name, end);
|
||||
popNode();
|
||||
};
|
||||
|
||||
function setValue(node, begin, end) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ define(function(require, exports, module){
|
|||
};
|
||||
};
|
||||
|
||||
var keys = "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|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position".split("|");
|
||||
var keys = "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|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position|strict".split("|");
|
||||
var keywords = keys.map(
|
||||
function(val) { return { name: "'" + val + "'", token: "keyword" }; }
|
||||
);
|
||||
|
|
@ -100,8 +100,8 @@ define(function(require, exports, module){
|
|||
{ 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){ if(stack.length > 1) { stack.pop(); } } }
|
||||
{ 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(); } }
|
||||
|
|
|
|||
|
|
@ -177,7 +177,9 @@ GroupByClause
|
|||
GroupingSpecList
|
||||
::= GroupingSpec ( ',' GroupingSpec )*
|
||||
GroupingSpec
|
||||
::= '$' VarName ( TypeDeclaration? ':=' ExprSingle )? ( 'collation' URILiteral )?
|
||||
::= GroupingVariable ( TypeDeclaration? ':=' ExprSingle )? ( 'collation' URILiteral )?
|
||||
GroupingVariable
|
||||
::= '$' VarName
|
||||
OrderByClause
|
||||
::= ( 'order' 'by' | 'stable' 'order' 'by' ) OrderSpecList
|
||||
OrderSpecList
|
||||
|
|
@ -773,6 +775,9 @@ FunctionName
|
|||
| 'constraint'
|
||||
| 'loop'
|
||||
| 'returning'
|
||||
| 'object'
|
||||
| 'json-item'
|
||||
| 'array'
|
||||
NCName ::= NCName^Token
|
||||
| 'after'
|
||||
| 'and'
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -469,13 +469,13 @@ CharRef ::= '&#' [0-9]+ ';'
|
|||
| '&#x' [0-9A-Fa-f]+ ';'
|
||||
Digits ::= [0-9]+
|
||||
CommentContents
|
||||
::= ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) & '('
|
||||
::= ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) & '(:'
|
||||
| ( Char+ - ( 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* ) ) & ' @'
|
||||
| ( Char+ - ( Char* ( '(:' | ':)' | ' @') Char* ) ) & $
|
||||
EOF ::= $
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue