From 638abda97cf458d9243804b75de53714209e8632 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 1 Sep 2023 08:56:11 +0200 Subject: [PATCH] [go mode] Allow underscore separators in numbers Closes https://github.com/codemirror/codemirror5/issues/7059 --- mode/go/go.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mode/go/go.js b/mode/go/go.js index 8dbdc65d1c..bd54f1ab03 100644 --- a/mode/go/go.js +++ b/mode/go/go.js @@ -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"; }