Improve XQuery highlighting
This commit is contained in:
parent
ee0fdbb74f
commit
43380a9045
8 changed files with 5441 additions and 5414 deletions
|
|
@ -201,12 +201,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var XQueryHighlightRules = function() {
|
var XQueryHighlightRules = function() {
|
||||||
|
|
||||||
var keywords = lang.arrayToMap(
|
var keywords = lang.arrayToMap(
|
||||||
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|encoding|" +
|
("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").split("|")
|
||||||
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
|
|
||||||
"using|stemming|collection|schema|" +
|
|
||||||
"while|validate|on|nodes|index|" +
|
|
||||||
"external|" +
|
|
||||||
"if|then|else|as|and|or|typeswitch|case|ascending|descending|empty|in|count|updating|insert|delete|replace|value|node|attribute|text|element|into|of|with|contains").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// regexp must not have capturing parentheses
|
||||||
|
|
@ -260,7 +255,7 @@ var XQueryHighlightRules = function() {
|
||||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
}, {
|
}, {
|
||||||
token: "keyword.operator",
|
token: "keyword.operator",
|
||||||
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
|
regex: "\\*|=|<|>|\\-|\\+"
|
||||||
}, {
|
}, {
|
||||||
token: "lparen",
|
token: "lparen",
|
||||||
regex: "[[({]"
|
regex: "[[({]"
|
||||||
|
|
@ -288,14 +283,14 @@ var XQueryHighlightRules = function() {
|
||||||
} ],
|
} ],
|
||||||
|
|
||||||
cdata : [ {
|
cdata : [ {
|
||||||
token : "text",
|
token : "comment",
|
||||||
regex : "\\]\\]>",
|
regex : "\\]\\]>",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "comment",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "comment",
|
||||||
regex : "(?:[^\\]]|\\](?!\\]>))+"
|
regex : "(?:[^\\]]|\\](?!\\]>))+"
|
||||||
} ],
|
} ],
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/StringLexer.g 2012-05-22 16:42:44
|
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/StringLexer.g 2012-05-24 17:09:24
|
||||||
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/XMLLexer.g 2012-05-22 16:42:46
|
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/XMLLexer.g 2012-05-24 17:09:26
|
||||||
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/XQueryLexer.g 2012-05-22 16:42:43
|
// $ANTLR 3.3 Nov 30, 2010 12:50:56 xquery/XQueryLexer.g 2012-05-24 17:09:22
|
||||||
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -79,7 +79,7 @@ define(function(require, exports, module){
|
||||||
if(lineTokens.length > 0) {
|
if(lineTokens.length > 0) {
|
||||||
lineTokens[lineTokens.length - 1].type;
|
lineTokens[lineTokens.length - 1].type;
|
||||||
}
|
}
|
||||||
nextState = nextState != "comment" ? "start" : nextState;
|
nextState = (nextState != "comment" && nextState != "string" && nextState != "cdata" && nextState != "tag") ? "start" : nextState;
|
||||||
|
|
||||||
if(cursor < (sourceLine.length )) {
|
if(cursor < (sourceLine.length )) {
|
||||||
value = sourceLine.substring(cursor);
|
value = sourceLine.substring(cursor);
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,39 @@
|
||||||
/*
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* eXide - web-based XQuery IDE
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Wolfgang Meier
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
* it under the terms of the GNU General Public License as published by
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* for the specific language governing rights and limitations under the
|
||||||
* (at your option) any later version.
|
* License.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* The Initial Developer of the Original Code is
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* Ajax.org B.V.
|
||||||
*/
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* William Candillon <wcandillon AT gmail DOT com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
@ -26,12 +44,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var XQueryHighlightRules = function() {
|
var XQueryHighlightRules = function() {
|
||||||
|
|
||||||
var keywords = lang.arrayToMap(
|
var keywords = lang.arrayToMap(
|
||||||
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|encoding|" +
|
("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").split("|")
|
||||||
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
|
|
||||||
"using|stemming|collection|schema|" +
|
|
||||||
"while|validate|on|nodes|index|" +
|
|
||||||
"external|" +
|
|
||||||
"if|then|else|as|and|or|typeswitch|case|ascending|descending|empty|in|count|updating|insert|delete|replace|value|node|attribute|text|element|into|of|with|contains").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// regexp must not have capturing parentheses
|
||||||
|
|
@ -85,7 +98,7 @@ var XQueryHighlightRules = function() {
|
||||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
}, {
|
}, {
|
||||||
token: "keyword.operator",
|
token: "keyword.operator",
|
||||||
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
|
regex: "\\*|=|<|>|\\-|\\+"
|
||||||
}, {
|
}, {
|
||||||
token: "lparen",
|
token: "lparen",
|
||||||
regex: "[[({]"
|
regex: "[[({]"
|
||||||
|
|
@ -113,14 +126,14 @@ var XQueryHighlightRules = function() {
|
||||||
} ],
|
} ],
|
||||||
|
|
||||||
cdata : [ {
|
cdata : [ {
|
||||||
token : "text",
|
token : "comment",
|
||||||
regex : "\\]\\]>",
|
regex : "\\]\\]>",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "comment",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "comment",
|
||||||
regex : "(?:[^\\]]|\\](?!\\]>))+"
|
regex : "(?:[^\\]]|\\](?!\\]>))+"
|
||||||
} ],
|
} ],
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue