Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CodeMirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Aurel Pascal Schubotz
CodeMirror
Commits
c49bb5fe
Commit
c49bb5fe
authored
7 years ago
by
Christian Gruen
Committed by
Marijn Haverbeke
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[xquery mode] Update keyword list (support for XQ31, XQFT, XQUP)
parent
55aa5066
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mode/xquery/xquery.js
+33
-19
33 additions, 19 deletions
mode/xquery/xquery.js
with
33 additions
and
19 deletions
mode/xquery/xquery.js
+
33
−
19
View file @
c49bb5fe
...
@@ -29,31 +29,45 @@ CodeMirror.defineMode("xquery", function() {
...
@@ -29,31 +29,45 @@ CodeMirror.defineMode("xquery", function() {
// kwObj is what is return from this function at the end
// kwObj is what is return from this function at the end
var
kwObj
=
{
var
kwObj
=
{
'
if
'
:
A
,
'
switch
'
:
A
,
'
while
'
:
A
,
'
for
'
:
A
,
'
,
'
:
punctuation
'
else
'
:
B
,
'
then
'
:
B
,
'
try
'
:
B
,
'
finally
'
:
B
,
'
catch
'
:
B
,
'
element
'
:
C
,
'
attribute
'
:
C
,
'
let
'
:
C
,
'
implements
'
:
C
,
'
import
'
:
C
,
'
module
'
:
C
,
'
namespace
'
:
C
,
'
return
'
:
C
,
'
super
'
:
C
,
'
this
'
:
C
,
'
throws
'
:
C
,
'
where
'
:
C
,
'
private
'
:
C
,
'
,
'
:
punctuation
,
'
null
'
:
atom
,
'
fn:false()
'
:
atom
,
'
fn:true()
'
:
atom
};
};
// a list of 'basic' keywords. For each add a property to kwObj with the value of
// a list of 'basic' keywords. For each add a property to kwObj with the value of
// {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
// {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
var
basic
=
[
'
after
'
,
'
ancestor
'
,
'
ancestor-or-self
'
,
'
and
'
,
'
as
'
,
'
ascending
'
,
'
assert
'
,
'
attribute
'
,
'
before
'
,
var
basic
=
[
'
after
'
,
'
all
'
,
'
allowing
'
,
'
ancestor
'
,
'
ancestor-or-self
'
,
'
any
'
,
'
array
'
,
'
as
'
,
'
by
'
,
'
case
'
,
'
cast
'
,
'
child
'
,
'
comment
'
,
'
declare
'
,
'
default
'
,
'
define
'
,
'
descendant
'
,
'
descendant-or-self
'
,
'
ascending
'
,
'
at
'
,
'
attribute
'
,
'
base-uri
'
,
'
before
'
,
'
boundary-space
'
,
'
by
'
,
'
case
'
,
'
cast
'
,
'
descending
'
,
'
document
'
,
'
document-node
'
,
'
element
'
,
'
else
'
,
'
eq
'
,
'
every
'
,
'
except
'
,
'
external
'
,
'
following
'
,
'
castable
'
,
'
catch
'
,
'
child
'
,
'
collation
'
,
'
comment
'
,
'
construction
'
,
'
contains
'
,
'
content
'
,
'
following-sibling
'
,
'
follows
'
,
'
for
'
,
'
function
'
,
'
if
'
,
'
import
'
,
'
in
'
,
'
instance
'
,
'
intersect
'
,
'
item
'
,
'
context
'
,
'
copy
'
,
'
copy-namespaces
'
,
'
count
'
,
'
decimal-format
'
,
'
declare
'
,
'
default
'
,
'
delete
'
,
'
let
'
,
'
module
'
,
'
namespace
'
,
'
node
'
,
'
node
'
,
'
of
'
,
'
only
'
,
'
or
'
,
'
order
'
,
'
parent
'
,
'
precedes
'
,
'
preceding
'
,
'
descendant
'
,
'
descendant-or-self
'
,
'
descending
'
,
'
diacritics
'
,
'
different
'
,
'
distance
'
,
'
preceding-sibling
'
,
'
processing-instruction
'
,
'
ref
'
,
'
return
'
,
'
returns
'
,
'
satisfies
'
,
'
schema
'
,
'
schema-element
'
,
'
document
'
,
'
document-node
'
,
'
element
'
,
'
else
'
,
'
empty
'
,
'
empty-sequence
'
,
'
encoding
'
,
'
end
'
,
'
self
'
,
'
some
'
,
'
sortby
'
,
'
stable
'
,
'
text
'
,
'
then
'
,
'
to
'
,
'
treat
'
,
'
typeswitch
'
,
'
union
'
,
'
variable
'
,
'
version
'
,
'
where
'
,
'
entire
'
,
'
every
'
,
'
exactly
'
,
'
except
'
,
'
external
'
,
'
first
'
,
'
following
'
,
'
following-sibling
'
,
'
xquery
'
,
'
empty-sequence
'
];
'
for
'
,
'
from
'
,
'
ftand
'
,
'
ftnot
'
,
'
ft-option
'
,
'
ftor
'
,
'
function
'
,
'
fuzzy
'
,
'
greatest
'
,
'
group
'
,
'
if
'
,
'
import
'
,
'
in
'
,
'
inherit
'
,
'
insensitive
'
,
'
insert
'
,
'
instance
'
,
'
intersect
'
,
'
into
'
,
'
invoke
'
,
'
is
'
,
'
item
'
,
'
language
'
,
'
last
'
,
'
lax
'
,
'
least
'
,
'
let
'
,
'
levels
'
,
'
lowercase
'
,
'
map
'
,
'
modify
'
,
'
module
'
,
'
most
'
,
'
namespace
'
,
'
next
'
,
'
no
'
,
'
node
'
,
'
nodes
'
,
'
no-inherit
'
,
'
no-preserve
'
,
'
not
'
,
'
occurs
'
,
'
of
'
,
'
only
'
,
'
option
'
,
'
order
'
,
'
ordered
'
,
'
ordering
'
,
'
paragraph
'
,
'
paragraphs
'
,
'
parent
'
,
'
phrase
'
,
'
preceding
'
,
'
preceding-sibling
'
,
'
preserve
'
,
'
previous
'
,
'
processing-instruction
'
,
'
relationship
'
,
'
rename
'
,
'
replace
'
,
'
return
'
,
'
revalidation
'
,
'
same
'
,
'
satisfies
'
,
'
schema
'
,
'
schema-attribute
'
,
'
schema-element
'
,
'
score
'
,
'
self
'
,
'
sensitive
'
,
'
sentence
'
,
'
sentences
'
,
'
sequence
'
,
'
skip
'
,
'
sliding
'
,
'
some
'
,
'
stable
'
,
'
start
'
,
'
stemming
'
,
'
stop
'
,
'
strict
'
,
'
strip
'
,
'
switch
'
,
'
text
'
,
'
then
'
,
'
thesaurus
'
,
'
times
'
,
'
to
'
,
'
transform
'
,
'
treat
'
,
'
try
'
,
'
tumbling
'
,
'
type
'
,
'
typeswitch
'
,
'
union
'
,
'
unordered
'
,
'
update
'
,
'
updating
'
,
'
uppercase
'
,
'
using
'
,
'
validate
'
,
'
value
'
,
'
variable
'
,
'
version
'
,
'
weight
'
,
'
when
'
,
'
where
'
,
'
wildcards
'
,
'
window
'
,
'
with
'
,
'
without
'
,
'
word
'
,
'
words
'
,
'
xquery
'
];
for
(
var
i
=
0
,
l
=
basic
.
length
;
i
<
l
;
i
++
)
{
kwObj
[
basic
[
i
]]
=
kw
(
basic
[
i
]);};
for
(
var
i
=
0
,
l
=
basic
.
length
;
i
<
l
;
i
++
)
{
kwObj
[
basic
[
i
]]
=
kw
(
basic
[
i
]);};
// a list of types. For each add a property to kwObj with the value of
// a list of types. For each add a property to kwObj with the value of
// {type: "atom", style: "atom"}
// {type: "atom", style: "atom"}
var
types
=
[
'
xs:string
'
,
'
xs:float
'
,
'
xs:decimal
'
,
'
xs:double
'
,
'
xs:integer
'
,
'
xs:boolean
'
,
'
xs:date
'
,
'
xs:dateTime
'
,
var
types
=
[
'
xs:anyAtomicType
'
,
'
xs:anySimpleType
'
,
'
xs:anyType
'
,
'
xs:anyURI
'
,
'
xs:time
'
,
'
xs:duration
'
,
'
xs:dayTimeDuration
'
,
'
xs:time
'
,
'
xs:yearMonthDuration
'
,
'
numeric
'
,
'
xs:hexBinary
'
,
'
xs:base64Binary
'
,
'
xs:boolean
'
,
'
xs:byte
'
,
'
xs:date
'
,
'
xs:dateTime
'
,
'
xs:dateTimeStamp
'
,
'
xs:base64Binary
'
,
'
xs:anyURI
'
,
'
xs:QName
'
,
'
xs:byte
'
,
'
xs:boolean
'
,
'
xs:anyURI
'
,
'
xf:yearMonthDuration
'
];
'
xs:dayTimeDuration
'
,
'
xs:decimal
'
,
'
xs:double
'
,
'
xs:duration
'
,
'
xs:ENTITIES
'
,
'
xs:ENTITY
'
,
'
xs:float
'
,
'
xs:gDay
'
,
'
xs:gMonth
'
,
'
xs:gMonthDay
'
,
'
xs:gYear
'
,
'
xs:gYearMonth
'
,
'
xs:hexBinary
'
,
'
xs:ID
'
,
'
xs:IDREF
'
,
'
xs:IDREFS
'
,
'
xs:int
'
,
'
xs:integer
'
,
'
xs:item
'
,
'
xs:java
'
,
'
xs:language
'
,
'
xs:long
'
,
'
xs:Name
'
,
'
xs:NCName
'
,
'
xs:negativeInteger
'
,
'
xs:NMTOKEN
'
,
'
xs:NMTOKENS
'
,
'
xs:nonNegativeInteger
'
,
'
xs:nonPositiveInteger
'
,
'
xs:normalizedString
'
,
'
xs:NOTATION
'
,
'
xs:numeric
'
,
'
xs:positiveInteger
'
,
'
xs:precisionDecimal
'
,
'
xs:QName
'
,
'
xs:short
'
,
'
xs:string
'
,
'
xs:time
'
,
'
xs:token
'
,
'
xs:unsignedByte
'
,
'
xs:unsignedInt
'
,
'
xs:unsignedLong
'
,
'
xs:unsignedShort
'
,
'
xs:untyped
'
,
'
xs:untypedAtomic
'
,
'
xs:yearMonthDuration
'
];
for
(
var
i
=
0
,
l
=
types
.
length
;
i
<
l
;
i
++
)
{
kwObj
[
types
[
i
]]
=
atom
;};
for
(
var
i
=
0
,
l
=
types
.
length
;
i
<
l
;
i
++
)
{
kwObj
[
types
[
i
]]
=
atom
;};
// each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
// each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
...
@@ -102,7 +116,7 @@ CodeMirror.defineMode("xquery", function() {
...
@@ -102,7 +116,7 @@ CodeMirror.defineMode("xquery", function() {
}
}
// start code block
// start code block
else
if
(
ch
==
"
{
"
)
{
else
if
(
ch
==
"
{
"
)
{
pushStateStack
(
state
,{
type
:
"
codeblock
"
});
pushStateStack
(
state
,
{
type
:
"
codeblock
"
});
return
null
;
return
null
;
}
}
// end code block
// end code block
...
@@ -132,7 +146,7 @@ CodeMirror.defineMode("xquery", function() {
...
@@ -132,7 +146,7 @@ CodeMirror.defineMode("xquery", function() {
return
chain
(
stream
,
state
,
tokenComment
);
return
chain
(
stream
,
state
,
tokenComment
);
}
}
// quoted string
// quoted string
else
if
(
!
isEQName
&&
(
ch
===
'
"
'
||
ch
===
"
'
"
))
else
if
(
!
isEQName
&&
(
ch
===
'
"
'
||
ch
===
"
'
"
))
return
chain
(
stream
,
state
,
tokenString
(
ch
));
return
chain
(
stream
,
state
,
tokenString
(
ch
));
// variable
// variable
else
if
(
ch
===
"
$
"
)
{
else
if
(
ch
===
"
$
"
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment