Add support for eqname syntax.

This commit is contained in:
William Candillon 2013-01-02 13:54:21 +01:00 committed by nightwing
commit 345b5f7626

View file

@ -39,6 +39,12 @@ var XQueryHighlightRules = function() {
keyword: "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"
}, "identifier");
var nameStartChar = "[_A-Za-z]";
var nameChar = "[-\\._A-Za-z0-9]";
var ncname = nameStartChar + nameChar + "*";
var qname = "(?:" + ncname + ":)?" + ncname;
var eqname = "(?:(?:Q{.*}" + ncname + ")|(?:" + qname + "))";
// regexp must not have capturing parentheses
// regexps are ordered -> the first match is used
this.$rules = {
@ -73,7 +79,7 @@ var XQueryHighlightRules = function() {
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token: "variable", // variable
regex: "\\$[a-zA-Z_][a-zA-Z0-9_\\-:]*\\b"
regex: "\\$" + eqname
}, {
token: "string",
regex: '".*?"'