Repository: groovy
Updated Branches:
  refs/heads/master 5f8d99b70 -> cf2658b9d


Support empty statement as the first statement in a block


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

Branch: refs/heads/master
Commit: cf2658b9debcaf41c49e3aee8c07fdbbcf0af2a0
Parents: 5f8d99b
Author: sunlan <sun...@apache.org>
Authored: Wed Aug 9 00:09:39 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Wed Aug 9 00:09:39 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/cf2658b9/src/main/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4
index 7519e04..362706e 100644
--- a/src/main/antlr/GroovyParser.g4
+++ b/src/main/antlr/GroovyParser.g4
@@ -562,7 +562,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/cf2658b9/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