Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X c8262f5a5 -> ca6b98223


Support empty statement as the first statement in a block

(cherry picked from commit cf2658b)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: ca6b98223b60a147c2ceda0decd4ca8a5bb3c672
Parents: c8262f5
Author: sunlan <sun...@apache.org>
Authored: Wed Aug 9 00:09:39 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Wed Aug 9 00:10:38 2017 +0800

----------------------------------------------------------------------
 src/main/antlr/GroovyParser.g4                                    | 2 +-
 .../parser-antlr4/src/test/resources/core/IfElse_01.groovy        | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/ca6b9822/src/main/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4
index c53a28b..dcda653 100644
--- a/src/main/antlr/GroovyParser.g4
+++ b/src/main/antlr/GroovyParser.g4
@@ -595,7 +595,7 @@ elementValueArrayInitializer
 // STATEMENTS / BLOCKS
 
 block
-    :   LBRACE nls blockStatementsOpt RBRACE
+    :   LBRACE (nls | sep+) blockStatementsOpt RBRACE
     ;
 
 blockStatement

http://git-wip-us.apache.org/repos/asf/groovy/blob/ca6b9822/subprojects/parser-antlr4/src/test/resources/core/IfElse_01.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/core/IfElse_01.groovy 
b/subprojects/parser-antlr4/src/test/resources/core/IfElse_01.groovy
index 94687b8..168cb0a 100644
--- a/subprojects/parser-antlr4/src/test/resources/core/IfElse_01.groovy
+++ b/subprojects/parser-antlr4/src/test/resources/core/IfElse_01.groovy
@@ -60,3 +60,6 @@ if(true)
     1;
 else
     0;
+
+if (false) { ;out<<_s[_i]
+}

Reply via email to