Commit dd44c943 for codemirror.net
commit dd44c943cc25109d73041abb9f859581c4dec07a
Author: Marijn Haverbeke <marijn@haverbeke.berlin>
Date: Wed Aug 28 10:21:47 2024 +0200
[groovy mode] Stop parsing interpolated variable names when hitting whitespace
Closes https://github.com/codemirror/codemirror5/issues/7103
diff --git a/mode/groovy/groovy.js b/mode/groovy/groovy.js
index 89d0fe08..24d886eb 100644
--- a/mode/groovy/groovy.js
+++ b/mode/groovy/groovy.js
@@ -129,10 +129,8 @@ CodeMirror.defineMode("groovy", function(config) {
function tokenVariableDeref(stream, state) {
var next = stream.match(/^(\.|[\w\$_]+)/)
- if (!next) {
- state.tokenize.pop()
- return state.tokenize[state.tokenize.length-1](stream, state)
- }
+ if (!next || !stream.match(next[0] == "." ? /^[\w$_]/ : /^\./)) state.tokenize.pop()
+ if (!next) return state.tokenize[state.tokenize.length-1](stream, state)
return next[0] == "." ? null : "variable"
}