Minor improvements in the XQuery syntax highlighter.

This commit is contained in:
William Candillon 2012-02-13 10:04:06 +01:00
commit 240f68cd9a
8 changed files with 44 additions and 38 deletions

View file

@ -11,7 +11,7 @@
Ace
version 0.2.0
commit 67ba8f5f29ed1d0c3b3d31229d5597a99860f21c
commit 517e88f2f077263e49159c7b1742b5f3a7c605b4
-->

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -269,9 +269,11 @@ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightR
var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap(
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|" +
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|" +
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
"if|then|else|as|and|or|typeswitch|case|ascending|descending|empty|in").split("|")
"using|stemming|" +
"while|" +
"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
@ -316,6 +318,14 @@ var XQueryHighlightRules = function() {
token: "support.function",
regex: "\\w[\\w+_\\-:]+(?=\\()"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token: "keyword.operator",
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
}, {
@ -324,15 +334,7 @@ var XQueryHighlightRules = function() {
}, {
token: "rparen",
regex: "[\\])}]"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
} ],
} ],
tag : [ {
token : "text",

View file

@ -269,9 +269,11 @@ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightR
var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap(
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|" +
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|" +
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
"if|then|else|as|and|or|typeswitch|case|ascending|descending|empty|in").split("|")
"using|stemming|" +
"while|" +
"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
@ -316,6 +318,14 @@ var XQueryHighlightRules = function() {
token: "support.function",
regex: "\\w[\\w+_\\-:]+(?=\\()"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token: "keyword.operator",
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
}, {
@ -324,15 +334,7 @@ var XQueryHighlightRules = function() {
}, {
token: "rparen",
regex: "[\\])}]"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
} ],
} ],
tag : [ {
token : "text",

File diff suppressed because one or more lines are too long

View file

@ -25,9 +25,11 @@ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightR
var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap(
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|" +
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|" +
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
"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").split("|")
"using|stemming|" +
"while|" +
"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
@ -72,6 +74,14 @@ var XQueryHighlightRules = function() {
token: "support.function",
regex: "\\w[\\w+_\\-:]+(?=\\()"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token: "keyword.operator",
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
}, {
@ -80,15 +90,7 @@ var XQueryHighlightRules = function() {
}, {
token: "rparen",
regex: "[\\])}]"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
} ],
} ],
tag : [ {
token : "text",