@@ -19,11 +19,18 @@ CodeMirror.defineMode("sparql", function(config) {
1919 return new RegExp ( "^(?:" + words . join ( "|" ) + ")$" , "i" ) ;
2020 }
2121 var ops = wordRegexp ( [ "str" , "lang" , "langmatches" , "datatype" , "bound" , "sameterm" , "isiri" , "isuri" ,
22+ "iri" , "uri" , "bnode" , "count" , "sum" , "min" , "max" , "avg" , "sample" ,
23+ "group_concat" , "rand" , "abs" , "ceil" , "floor" , "round" , "concat" , "substr" , "strlen" ,
24+ "replace" , "ucase" , "lcase" , "encode_for_uri" , "contains" , "strstarts" , "strends" ,
25+ "strbefore" , "strafter" , "year" , "month" , "day" , "hours" , "minutes" , "seconds" ,
26+ "timezone" , "tz" , "now" , "uuid" , "struuid" , "md5" , "sha1" , "sha256" , "sha384" ,
27+ "sha512" , "coalesce" , "if" , "strlang" , "strdt" , "isnumeric" , "regex" , "exists" ,
2228 "isblank" , "isliteral" , "a" ] ) ;
2329 var keywords = wordRegexp ( [ "base" , "prefix" , "select" , "distinct" , "reduced" , "construct" , "describe" ,
2430 "ask" , "from" , "named" , "where" , "order" , "limit" , "offset" , "filter" , "optional" ,
2531 "graph" , "by" , "asc" , "desc" , "as" , "having" , "undef" , "values" , "group" ,
2632 "minus" , "in" , "not" , "service" , "silent" , "using" , "insert" , "delete" , "union" ,
33+ "true" , "false" , "with" ,
2734 "data" , "copy" , "to" , "move" , "add" , "create" , "drop" , "clear" , "load" ] ) ;
2835 var operatorChars = / [ * + \- < > = & | ] / ;
2936
@@ -44,20 +51,28 @@ CodeMirror.defineMode("sparql", function(config) {
4451 }
4552 else if ( / [ { } \( \) , \. ; \[ \] ] / . test ( ch ) ) {
4653 curPunc = ch ;
47- return null ;
54+ return "bracket" ;
4855 }
4956 else if ( ch == "#" ) {
5057 stream . skipToEnd ( ) ;
5158 return "comment" ;
5259 }
5360 else if ( operatorChars . test ( ch ) ) {
5461 stream . eatWhile ( operatorChars ) ;
55- return null ;
62+ return "operator" ;
5663 }
5764 else if ( ch == ":" ) {
5865 stream . eatWhile ( / [ \w \d \. _ \- ] / ) ;
5966 return "atom" ;
6067 }
68+ else if ( ch == "@" ) {
69+ stream . eatWhile ( / [ a - z \d \- ] / i) ;
70+ return "meta" ;
71+ }
72+ else if ( ch == "^" ) {
73+ stream . eatWhile ( / \^ / ) ;
74+ return "meta" ;
75+ }
6176 else {
6277 stream . eatWhile ( / [ _ \w \d ] / ) ;
6378 if ( stream . eat ( ":" ) ) {
@@ -66,7 +81,7 @@ CodeMirror.defineMode("sparql", function(config) {
6681 }
6782 var word = stream . current ( ) ;
6883 if ( ops . test ( word ) )
69- return null ;
84+ return "builtin" ;
7085 else if ( keywords . test ( word ) )
7186 return "keyword" ;
7287 else
@@ -155,6 +170,6 @@ CodeMirror.defineMode("sparql", function(config) {
155170 } ;
156171} ) ;
157172
158- CodeMirror . defineMIME ( "application/x- sparql-query" , "sparql" ) ;
173+ CodeMirror . defineMIME ( "application/sparql-query" , "sparql" ) ;
159174
160175} ) ;
0 commit comments