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/02/04 00:48:36 UTC

[groovy] 01/02: Tweak `variableDeclaration` rule

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

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

commit bc84072f29d48977b5951d9777f47201ece834b1
Author: Sam Harwell <sa...@tunnelvisionlabs.com>
AuthorDate: Tue Feb 4 05:01:43 2020 +0800

    Tweak `variableDeclaration` rule
    
    ```
    classifiedModifiers[$t]? type variableDeclarators
    ```
    
    can be written as:
    
    ```
    ( classifiedModifiers[$t] type variableDeclarators
    | type variableDeclarators
    )
    ```
---
 src/antlr/GroovyParser.g4 | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 93d4662..d77c581 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -592,13 +592,11 @@ classifiedModifiers[int t]
  *  t   0: local variable declaration; 1: field declaration
  */
 variableDeclaration[int t]
-@leftfactor { classifiedModifiers }
     :   classifiedModifiers[$t]
         (   type? variableDeclarators
         |   typeNamePairs nls ASSIGN nls variableInitializer
         )
     |
-        classifiedModifiers[$t]?
         type variableDeclarators
     ;