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


Revert "Support empty statement as the first statement in a block"

This reverts commit 8a5072f


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

Branch: refs/heads/GROOVY_2_6_X
Commit: c8262f5a5c85930cb098fefb027bb3a2d9e759f3
Parents: 8a5072f
Author: sunlan <sun...@apache.org>
Authored: Wed Aug 9 00:07:20 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Wed Aug 9 00:07:20 2017 +0800

----------------------------------------------------------------------
 src/main/antlr/GroovyParser.g4                  | 37 ++++++++++++++++++--
 .../src/test/resources/core/IfElse_01.groovy    |  3 --
 2 files changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/c8262f5a/src/main/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4
index 362706e..c53a28b 100644
--- a/src/main/antlr/GroovyParser.g4
+++ b/src/main/antlr/GroovyParser.g4
@@ -41,14 +41,17 @@ options {
 
 @header {
     import java.util.Map;
+    import org.codehaus.groovy.util.ListHashMap;
     import org.codehaus.groovy.ast.NodeMetaDataHandler;
+    import org.codehaus.groovy.ast.NodeMetaDataHandlerHelper;
     import org.apache.groovy.parser.antlr4.SemanticPredicates;
 }
 
 @members {
 
     public static class GroovyParserRuleContext extends ParserRuleContext 
implements NodeMetaDataHandler {
-        private Map metaDataMap = null;
+        private Map<?, ?> metaDataMap = null;
+        private NodeMetaDataHandlerHelper helper = new 
NodeMetaDataHandlerHelper(this);
 
         public GroovyParserRuleContext() {}
 
@@ -57,6 +60,36 @@ options {
         }
 
         @Override
+        public <T> T getNodeMetaData(Object key) {
+            return helper.getNodeMetaData(key);
+        }
+
+        @Override
+        public void copyNodeMetaData(NodeMetaDataHandler other) {
+            helper.copyNodeMetaData(other);
+        }
+
+        @Override
+        public void setNodeMetaData(Object key, Object value) {
+            helper.setNodeMetaData(key, value);
+        }
+
+        @Override
+        public Object putNodeMetaData(Object key, Object value) {
+            return helper.putNodeMetaData(key, value);
+        }
+
+        @Override
+        public void removeNodeMetaData(Object key) {
+            helper.removeNodeMetaData(key);
+        }
+
+        @Override
+        public Map<?, ?> getNodeMetaData() {
+            return helper.getNodeMetaData();
+        }
+
+        @Override
         public Map<?, ?> getMetaDataMap() {
             return this.metaDataMap;
         }
@@ -562,7 +595,7 @@ elementValueArrayInitializer
 // STATEMENTS / BLOCKS
 
 block
-    :   LBRACE (nls | sep+) blockStatementsOpt RBRACE
+    :   LBRACE nls blockStatementsOpt RBRACE
     ;
 
 blockStatement

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

Reply via email to