Skip to content

Commit 638abda

Browse files
committed
[go mode] Allow underscore separators in numbers
Closes codemirror#7059
1 parent 854ee51 commit 638abda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mode/go/go.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ CodeMirror.defineMode("go", function(config) {
4646
}
4747
if (/[\d\.]/.test(ch)) {
4848
if (ch == ".") {
49-
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
49+
stream.match(/^[0-9_]+([eE][\-+]?[0-9_]+)?/);
5050
} else if (ch == "0") {
51-
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
51+
stream.match(/^[xX][0-9a-fA-F_]+/) || stream.match(/^[0-7_]+/);
5252
} else {
53-
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
53+
stream.match(/^[0-9_]*\.?[0-9_]*([eE][\-+]?[0-9_]+)?/);
5454
}
5555
return "number";
5656
}

0 commit comments

Comments
 (0)