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 2020/06/30 01:49:50 UTC

[groovy] 01/01: Tweak `methodDeclaration` rule

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

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

commit 0fafc569d47a2a3e3bc7941ed2781c282d1f8d25
Author: Daniel Sun <su...@apache.org>
AuthorDate: Tue Jun 30 09:49:14 2020 +0800

    Tweak `methodDeclaration` rule
---
 src/antlr/GroovyParser.g4 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 52d7e4a..9feca64 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -267,14 +267,14 @@ memberDeclaration[int t]
  *  ct  9: script, other see the comment of classDeclaration
  */
 methodDeclaration[int t, int ct]
-    :   modifiersOpt
-        (   { 3 == $ct }?
-            returnType[$ct] methodName LPAREN rparen (DEFAULT nls elementValue)?
+    :   modifiersOpt typeParameters? returnType[$ct]?
+        methodName formalParameters
+        (
+            DEFAULT nls elementValue
         |
-            typeParameters? returnType[$ct]?
-            methodName formalParameters (nls THROWS nls qualifiedClassNameList)?
+            (nls THROWS nls qualifiedClassNameList)?
             (nls methodBody)?
-        )
+        )?
     ;
 
 methodName