groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Groovysh sticks to the old parser until GROOVY-8279 is fixed
Date Tue, 08 Aug 2017 00:12:38 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 0f1418d8e -> 72e1c2888


Groovysh sticks to the old parser until GROOVY-8279 is fixed


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

Branch: refs/heads/master
Commit: 72e1c28886bca2e1472f3bdb4d831c2e647fadce
Parents: 0f1418d
Author: sunlan <sunlan@apache.org>
Authored: Tue Aug 8 08:12:32 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Aug 8 08:12:32 2017 +0800

----------------------------------------------------------------------
 .../codehaus/groovy/control/CompilerConfiguration.java    | 10 +++++++++-
 .../groovy/org/codehaus/groovy/tools/shell/Parser.groovy  |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/72e1c288/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
index e924c2c..d84530f 100644
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -197,7 +197,7 @@ public class CompilerConfiguration {
      * defines if antlr2 parser should be used or the antlr4 one if
      * no factory is set yet
      */
-    private boolean antlr2Parser = true;
+    private boolean antlr2Parser = true; // TODO replace it with ParserVersion
 
     /**
      * Sets the Flags to defaults.
@@ -911,4 +911,12 @@ public class CompilerConfiguration {
 
         return ParserVersion.V_4;
     }
+
+    public void setParserVersion(ParserVersion parserVersion) {
+        if (ParserVersion.V_2 == parserVersion) {
+            this.antlr2Parser = true;
+        } else {
+            this.antlr2Parser = false;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/72e1c288/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Parser.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Parser.groovy
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Parser.groovy
index ecb8477..3bb9230 100644
--- a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Parser.groovy
+++ b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Parser.groovy
@@ -18,6 +18,7 @@
  */
 package org.codehaus.groovy.tools.shell
 
+import org.codehaus.groovy.control.ParserVersion
 import org.codehaus.groovy.control.SourceUnit
 import org.codehaus.groovy.control.CompilationFailedException
 import org.codehaus.groovy.tools.shell.util.Logger
@@ -156,6 +157,7 @@ final class RigidParser implements Parsing
 
         try {
             parser = SourceUnit.create(SCRIPT_FILENAME, source, /*tolerance*/ 1)
+            parser.getConfiguration().setParserVersion(ParserVersion.V_2) // We have to stick
to the old parser before GROOVY-8279 is fixed
             parser.parse()
 
             log.debug('Parse complete')


Mime
View raw message