You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/11/04 18:46:42 UTC

[groovy] branch GROOVY-9301 created (now 7787e6b)

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

sunlan pushed a change to branch GROOVY-9301
in repository https://gitbox.apache.org/repos/asf/groovy.git.


      at 7787e6b  GROOVY-9301: Parser error for enum constant with comma followed by method

This branch includes the following new commits:

     new 7787e6b  GROOVY-9301: Parser error for enum constant with comma followed by method

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[groovy] 01/01: GROOVY-9301: Parser error for enum constant with comma followed by method

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY-9301
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 7787e6b2e4bcd485f38bae10bd83bd839b6c3350
Author: Daniel Sun <su...@apache.org>
AuthorDate: Tue Nov 5 02:46:32 2019 +0800

    GROOVY-9301: Parser error for enum constant with comma followed by method
    
    The fix is for the Parrot parser
---
 src/antlr/GroovyParser.g4                                        | 2 +-
 .../src/test/resources/core/EnumDeclaration_02.groovy            | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index ba238c5..03e6b66 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -259,7 +259,7 @@ classBody[int t]
     ;
 
 enumConstants
-    :   enumConstant (nls COMMA nls enumConstant)* (nls COMMA)?
+    :   enumConstant (nls COMMA nls enumConstant)*? (nls COMMA)?
     ;
 
 enumConstant
diff --git a/subprojects/parser-antlr4/src/test/resources/core/EnumDeclaration_02.groovy b/subprojects/parser-antlr4/src/test/resources/core/EnumDeclaration_02.groovy
index b4d8d13..633da0e 100644
--- a/subprojects/parser-antlr4/src/test/resources/core/EnumDeclaration_02.groovy
+++ b/subprojects/parser-antlr4/src/test/resources/core/EnumDeclaration_02.groovy
@@ -93,3 +93,12 @@ class TestClass {
         }
     }
 }
+
+enum Orientation {
+    LANDSCAPE, PORTRAIT,
+
+    @Override
+    String toString() {
+        name().toLowerCase().capitalize()
+    }
+}