This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new a9197989c4 GROOVY-8162: Update Groovysh to JLine3 (tweak variable 
regex)
a9197989c4 is described below

commit a9197989c4be045021ef549c1c36ee86c494b0ba
Author: Paul King <[email protected]>
AuthorDate: Sun Aug 3 18:41:53 2025 +1000

    GROOVY-8162: Update Groovysh to JLine3 (tweak variable regex)
---
 .../main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java
 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java
index b002f6918e..b2d8c1c8e3 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java
@@ -108,10 +108,10 @@ public class GroovyEngine implements ScriptEngine {
     private static final String VAR_GROOVY_OPTIONS = "GROOVY_OPTIONS";
     private static final String DEFAULT_NANORC_SYNTAX = 
"classpath:/nanorc/jnanorc";
     private static final String REGEX_SYSTEM_VAR = "[A-Z]+[A-Z_]*";
-    private static final String BASE_REGEX_VAR = "[\\p{L}_$][\\p{L}\\p{N}_$]+";
+    private static final String BASE_REGEX_VAR = "[\\p{L}_$][\\p{L}\\p{N}_$]*";
     private static final String REGEX_VAR = "(" + BASE_REGEX_VAR + ")";
     private static final String METHOD_REGEX_VAR = "(" + BASE_REGEX_VAR + 
"|\"(?:[^\"\\\\]|\\\\.)*\")";
-    private static final String ANNOTATIONS = 
"^\\s*(?:@(?!interface)(?:[\\p{L}_$][\\p{L}\\p{N}_$]*\\.)*[\\p{L}_$][\\p{L}\\p{N}_$]*(?:\\([^)]*\\))?\\s*)*";
+    private static final String ANNOTATIONS = 
"((?:@(?!interface)(?:[\\p{L}_$][\\p{L}\\p{N}_$]*\\.)*[\\p{L}_$][\\p{L}\\p{N}_$]*(?:\\([^)]*\\))?\\s*)*\\s+)?";
     private static final String MODIFIERS = 
"(?:(?:public|protected|private|abstract|final|static|sealed|non-sealed|strictfp)\\s+)*";
     private static final String BODY = "\\s*(.*?\\{.*?})(|;|\n)$";
     private static final String PARAMS = "\\(([\\p{L}\\p{N}_ ,]*)\\)";

Reply via email to