Skip to content

Commit

Permalink
GROOVY-8551: Eliminate duplicated rules of parser
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellansun committed Jan 18, 2025
1 parent 4b5c65f commit 4359f1c
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 45 deletions.
18 changes: 10 additions & 8 deletions src/antlr/GroovyParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1141,17 +1141,19 @@ options { baseContext = mapEntryLabel; }
creator[int t]
: createdName
( nls arguments anonymousInnerClassDeclaration[0]?
| dim0+ nls arrayInitializer
| dim1+ dim0*
| dim[0]+ nls arrayInitializer
| dim[1]+ dim[0]*
)
;

dim0
: annotationsOpt LBRACK RBRACK
;

dim1
: annotationsOpt LBRACK expression RBRACK
dim[int n]
: annotationsOpt LBRACK
(
{ $n == 1 }?
expression
|
)
RBRACK
;

arrayInitializer
Expand Down
Loading

0 comments on commit 4359f1c

Please sign in to comment.