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 2017/04/22 01:19:41 UTC

[34/40] groovy git commit: Support array initializer span rows

Support array initializer span rows


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5785914c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5785914c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5785914c

Branch: refs/heads/parrot
Commit: 5785914cf476777375079fc311828359ad2b795b
Parents: ed091e5
Author: sunlan <su...@apache.org>
Authored: Sat Apr 22 00:46:28 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sat Apr 22 00:46:28 2017 +0800

----------------------------------------------------------------------
 .../org/apache/groovy/parser/antlr4/GroovyParser.g4   |  2 +-
 .../src/test/resources/core/Array_01x.groovy          | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/5785914c/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyParser.g4 b/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyParser.g4
index daeb7b3..75129c9 100644
--- a/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyParser.g4
+++ b/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyParser.g4
@@ -1092,7 +1092,7 @@ creator
     :   createdName
         (   nls arguments anonymousInnerClassDeclaration[0]?
         |   (LBRACK expression RBRACK)+ (b+=LBRACK RBRACK)*
-        |   (b+=LBRACK RBRACK)+ arrayInitializer
+        |   (b+=LBRACK RBRACK)+ nls arrayInitializer
         )
     ;
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/5785914c/subprojects/groovy-parser-antlr4/src/test/resources/core/Array_01x.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/test/resources/core/Array_01x.groovy b/subprojects/groovy-parser-antlr4/src/test/resources/core/Array_01x.groovy
index 033cb34..2092db4 100644
--- a/subprojects/groovy-parser-antlr4/src/test/resources/core/Array_01x.groovy
+++ b/subprojects/groovy-parser-antlr4/src/test/resources/core/Array_01x.groovy
@@ -32,6 +32,13 @@ def testArrayInitializer() {
     assert c[0] == 'a'
     assert c[1] == 'b'
     assert c[2] == 'c'
+
+    assert new String[]
+            {
+                'a', 'b'
+            }
+    ==
+            ['a', 'b'] as String[]
 }
 testArrayInitializer();
 
@@ -68,5 +75,12 @@ def testArrayInitializerCS() {
     assert c[0] == 'a'
     assert c[1] == 'b'
     assert c[2] == 'c'
+
+    assert new String[]
+            {
+                'a', 'b'
+            }
+    ==
+    ['a', 'b'] as String[]
 }
 testArrayInitializerCS();
\ No newline at end of file