Skip to content

Commit c955a0f

Browse files
authored
[spaqrl mode] Fix parsing of veriables after operators
Question-mark characters should only be styled as operators within triple patterns. For example the command SELECT * WHERE { BIND(?A+?B AS ?C) } should not have the "+?" sequence styled as "operator". NB the problem does not occur if there is a space between these two characters. With the fix "?A" and "?B" will both be styled as variable-2 (and "+" as operator). By processing operators characters (mostly) one at a time, the existing code on line 40 to zealously interpret anything beginning with '?' as a variable can run in this case. NB Line 40 actually causes a false positive in the case where the '?' appears in a triple pattern as a property path operator: this fix does not address this existing bug: it is quite complicated as '?' can appear in both variables and property paths while the parser is in the "pattern" state.
1 parent 6597cc2 commit c955a0f

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

mode/sparql/sparql.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,7 @@ CodeMirror.defineMode("sparql", function(config) {
6060
stream.skipToEnd();
6161
return "comment";
6262
}
63-
else if (ch === "^") {
64-
ch = stream.peek();
65-
if (ch === "^") stream.eat("^");
66-
else stream.eatWhile(operatorChars);
67-
return "operator";
68-
}
6963
else if (operatorChars.test(ch)) {
70-
stream.eatWhile(operatorChars);
7164
return "operator";
7265
}
7366
else if (ch == ":") {

0 commit comments

Comments
 (0)