[sparql mode] Identify all characters in prefixes
This commit is contained in:
parent
e5071ebb0b
commit
e1fe2100d0
|
@ -33,6 +33,9 @@ CodeMirror.defineMode("sparql", function(config) {
|
|||
"true", "false", "with",
|
||||
"data", "copy", "to", "move", "add", "create", "drop", "clear", "load", "into"]);
|
||||
var operatorChars = /[*+\-<>=&|\^\/!\?]/;
|
||||
var PN_CHARS = "[A-Za-z_\\-0-9]";
|
||||
var PREFIX_START = new RegExp("[A-Za-z]");
|
||||
var PREFIX_REMAINDER = new RegExp("((" + PN_CHARS + "|\\.)*(" + PN_CHARS + "))?:");
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
@ -71,20 +74,18 @@ CodeMirror.defineMode("sparql", function(config) {
|
|||
stream.eatWhile(/[a-z\d\-]/i);
|
||||
return "meta";
|
||||
}
|
||||
else {
|
||||
stream.eatWhile(/[_\w\d]/);
|
||||
if (stream.eat(":")) {
|
||||
else if (PREFIX_START.test(ch) && stream.match(PREFIX_REMAINDER)) {
|
||||
eatPnLocal(stream);
|
||||
return "atom";
|
||||
}
|
||||
var word = stream.current();
|
||||
if (ops.test(word))
|
||||
return "builtin";
|
||||
else if (keywords.test(word))
|
||||
return "keyword";
|
||||
else
|
||||
return "variable";
|
||||
}
|
||||
stream.eatWhile(/[_\w\d]/);
|
||||
var word = stream.current();
|
||||
if (ops.test(word))
|
||||
return "builtin";
|
||||
else if (keywords.test(word))
|
||||
return "keyword";
|
||||
else
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function eatPnLocal(stream) {
|
||||
|
|
Loading…
Reference in New Issue