Skip to content

Commit 7b9f8a6

Browse files
[r mode] Remove extra test with more appropriate regexp
The rule for starting a variable name is: > A syntactically valid name consists of letters, numbers and the dot or underline characters and **starts with a letter or the dot not followed by a number**. Per https://stat.ethz.ch/R-manual/R-devel/library/base/html/make.names.html "dot not followed by a number" is handled by parsing numerics earlier
1 parent 8fed31e commit 7b9f8a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mode/r/r.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ CodeMirror.defineMode("r", function(config) {
5656
return "variable-3";
5757
} else if (ch == "." && stream.match(/.[.\d]+/)) {
5858
return "keyword";
59-
} else if (/[\w\.]/.test(ch) && ch != "_") {
59+
} else if (/[a-zA-Z\.]/.test(ch)) {
6060
stream.eatWhile(/[\w\.]/);
6161
var word = stream.current();
6262
if (atoms.propertyIsEnumerable(word)) return "atom";

0 commit comments

Comments
 (0)