Skip to content

Commit

Permalink
[go mode] Allow underscore separators in numbers
Browse files Browse the repository at this point in the history
Closes #7059
  • Loading branch information
marijnh committed Sep 1, 2023
1 parent 854ee51 commit 638abda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mode/go/go.js
Expand Up @@ -46,11 +46,11 @@ CodeMirror.defineMode("go", function(config) {
}
if (/[\d\.]/.test(ch)) {
if (ch == ".") {
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
stream.match(/^[0-9_]+([eE][\-+]?[0-9_]+)?/);
} else if (ch == "0") {
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
stream.match(/^[xX][0-9a-fA-F_]+/) || stream.match(/^[0-7_]+/);
} else {
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
stream.match(/^[0-9_]*\.?[0-9_]*([eE][\-+]?[0-9_]+)?/);
}
return "number";
}
Expand Down

0 comments on commit 638abda

Please sign in to comment.