Skip to content

Commit c49bb5f

Browse files
ChristianGruenmarijnh
authored andcommitted
[xquery mode] Update keyword list (support for XQ31, XQFT, XQUP)
1 parent 55aa506 commit c49bb5f

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed

mode/xquery/xquery.js

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,45 @@ CodeMirror.defineMode("xquery", function() {
2929

3030
// kwObj is what is return from this function at the end
3131
var kwObj = {
32-
'if': A, 'switch': A, 'while': A, 'for': A,
33-
'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B,
34-
'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C,
35-
'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C,
36-
',': punctuation,
37-
'null': atom, 'fn:false()': atom, 'fn:true()': atom
32+
',': punctuation
3833
};
3934

4035
// a list of 'basic' keywords. For each add a property to kwObj with the value of
4136
// {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
42-
var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before',
43-
'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self',
44-
'descending','document','document-node','element','else','eq','every','except','external','following',
45-
'following-sibling','follows','for','function','if','import','in','instance','intersect','item',
46-
'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding',
47-
'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element',
48-
'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where',
49-
'xquery', 'empty-sequence'];
37+
var basic = ['after', 'all', 'allowing', 'ancestor', 'ancestor-or-self', 'any', 'array', 'as',
38+
'ascending', 'at', 'attribute', 'base-uri', 'before', 'boundary-space', 'by', 'case', 'cast',
39+
'castable', 'catch', 'child', 'collation', 'comment', 'construction', 'contains', 'content',
40+
'context', 'copy', 'copy-namespaces', 'count', 'decimal-format', 'declare', 'default', 'delete',
41+
'descendant', 'descendant-or-self', 'descending', 'diacritics', 'different', 'distance',
42+
'document', 'document-node', 'element', 'else', 'empty', 'empty-sequence', 'encoding', 'end',
43+
'entire', 'every', 'exactly', 'except', 'external', 'first', 'following', 'following-sibling',
44+
'for', 'from', 'ftand', 'ftnot', 'ft-option', 'ftor', 'function', 'fuzzy', 'greatest', 'group',
45+
'if', 'import', 'in', 'inherit', 'insensitive', 'insert', 'instance', 'intersect', 'into',
46+
'invoke', 'is', 'item', 'language', 'last', 'lax', 'least', 'let', 'levels', 'lowercase', 'map',
47+
'modify', 'module', 'most', 'namespace', 'next', 'no', 'node', 'nodes', 'no-inherit',
48+
'no-preserve', 'not', 'occurs', 'of', 'only', 'option', 'order', 'ordered', 'ordering',
49+
'paragraph', 'paragraphs', 'parent', 'phrase', 'preceding', 'preceding-sibling', 'preserve',
50+
'previous', 'processing-instruction', 'relationship', 'rename', 'replace', 'return',
51+
'revalidation', 'same', 'satisfies', 'schema', 'schema-attribute', 'schema-element', 'score',
52+
'self', 'sensitive', 'sentence', 'sentences', 'sequence', 'skip', 'sliding', 'some', 'stable',
53+
'start', 'stemming', 'stop', 'strict', 'strip', 'switch', 'text', 'then', 'thesaurus', 'times',
54+
'to', 'transform', 'treat', 'try', 'tumbling', 'type', 'typeswitch', 'union', 'unordered',
55+
'update', 'updating', 'uppercase', 'using', 'validate', 'value', 'variable', 'version',
56+
'weight', 'when', 'where', 'wildcards', 'window', 'with', 'without', 'word', 'words', 'xquery'];
5057
for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);};
5158

5259
// a list of types. For each add a property to kwObj with the value of
5360
// {type: "atom", style: "atom"}
54-
var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime',
55-
'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary',
56-
'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration'];
61+
var types = ['xs:anyAtomicType', 'xs:anySimpleType', 'xs:anyType', 'xs:anyURI',
62+
'xs:base64Binary', 'xs:boolean', 'xs:byte', 'xs:date', 'xs:dateTime', 'xs:dateTimeStamp',
63+
'xs:dayTimeDuration', 'xs:decimal', 'xs:double', 'xs:duration', 'xs:ENTITIES', 'xs:ENTITY',
64+
'xs:float', 'xs:gDay', 'xs:gMonth', 'xs:gMonthDay', 'xs:gYear', 'xs:gYearMonth', 'xs:hexBinary',
65+
'xs:ID', 'xs:IDREF', 'xs:IDREFS', 'xs:int', 'xs:integer', 'xs:item', 'xs:java', 'xs:language',
66+
'xs:long', 'xs:Name', 'xs:NCName', 'xs:negativeInteger', 'xs:NMTOKEN', 'xs:NMTOKENS',
67+
'xs:nonNegativeInteger', 'xs:nonPositiveInteger', 'xs:normalizedString', 'xs:NOTATION',
68+
'xs:numeric', 'xs:positiveInteger', 'xs:precisionDecimal', 'xs:QName', 'xs:short', 'xs:string',
69+
'xs:time', 'xs:token', 'xs:unsignedByte', 'xs:unsignedInt', 'xs:unsignedLong',
70+
'xs:unsignedShort', 'xs:untyped', 'xs:untypedAtomic', 'xs:yearMonthDuration'];
5771
for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;};
5872

5973
// each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
@@ -102,7 +116,7 @@ CodeMirror.defineMode("xquery", function() {
102116
}
103117
// start code block
104118
else if(ch == "{") {
105-
pushStateStack(state,{ type: "codeblock"});
119+
pushStateStack(state, { type: "codeblock"});
106120
return null;
107121
}
108122
// end code block
@@ -132,7 +146,7 @@ CodeMirror.defineMode("xquery", function() {
132146
return chain(stream, state, tokenComment);
133147
}
134148
// quoted string
135-
else if ( !isEQName && (ch === '"' || ch === "'"))
149+
else if (!isEQName && (ch === '"' || ch === "'"))
136150
return chain(stream, state, tokenString(ch));
137151
// variable
138152
else if(ch === "$") {

0 commit comments

Comments
 (0)