[go mode] Allow underscore separators in numbers
Closes https://github.com/codemirror/codemirror5/issues/7059
This commit is contained in:
parent
854ee51ef2
commit
638abda97c
|
@ -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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue