Enable the new parser Parrot by default(use `-Dgroovy.antlr4=false` to turn 
back to the old parser)


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

Branch: refs/heads/parrot
Commit: 7a037562d0947ad290b461897dddd27112cba994
Parents: 5785914
Author: sunlan <[email protected]>
Authored: Sat Apr 22 02:42:26 2017 +0800
Committer: sunlan <[email protected]>
Committed: Sat Apr 22 02:42:26 2017 +0800

----------------------------------------------------------------------
 .travis.yml                                         |  2 +-
 .../groovy/control/CompilerConfiguration.java       | 16 ++++++++++++----
 subprojects/groovy-console/build.gradle             |  4 +---
 subprojects/groovy-parser-antlr4/build.gradle       | 11 +----------
 4 files changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7a037562/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e4f512c..9bf1700 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ matrix:
 
 install: true
 
-script: travis_wait 60 ./gradlew -PuseAntlr4=true test
+script: travis_wait 60 ./gradlew test
 
 before_cache:
   - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

http://git-wip-us.apache.org/repos/asf/groovy/blob/7a037562/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 cfffa83..a3107ac 100644
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -74,7 +74,8 @@ public class CompilerConfiguration {
      *  default context, then you probably just want <code>new 
CompilerConfiguration()</code>. 
      */
     public static final CompilerConfiguration DEFAULT = new 
CompilerConfiguration();
-    
+    public static final String GROOVY_ANTLR4_OPT = "groovy.antlr4";
+
     /**
      * See {@link WarningMessage} for levels.
      */
@@ -175,9 +176,12 @@ public class CompilerConfiguration {
 
     /**
      * defines if antlr2 parser should be used or the antlr4 one if
-     * no factory is set yet
+     * no factory is set yet.
+     *
+     * The antlr4 parser Parrot is enabled by default
+     *
      */
-    private boolean antlr2Parser = true;
+    private boolean antlr2Parser = false;
 
     /**
      * Sets the Flags to defaults.
@@ -233,7 +237,11 @@ public class CompilerConfiguration {
         setOptimizationOptions(options);
 
         try {
-            antlr2Parser = !"true".equals(System.getProperty("groovy.antlr4"));
+            String groovyAntlr4Opt = System.getProperty(GROOVY_ANTLR4_OPT);
+
+            if (null != groovyAntlr4Opt) {
+                antlr2Parser = !Boolean.valueOf(groovyAntlr4Opt);
+            }
         } catch (Exception e) {
             // IGNORE
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/7a037562/subprojects/groovy-console/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/build.gradle 
b/subprojects/groovy-console/build.gradle
index e40766e..8b61c95 100644
--- a/subprojects/groovy-console/build.gradle
+++ b/subprojects/groovy-console/build.gradle
@@ -27,9 +27,7 @@ dependencies {
 }
 
 task console(type: JavaExec, dependsOn:classes) {
-    if (rootProject.hasProperty('useAntlr4')) {
-        jvmArgs += ["-Dgroovy.antlr4=true", 
"-Dgroovy.extract.doc.comment=true"]
-    }
+    jvmArgs += ["-Dgroovy.extract.doc.comment=true"]
 
     main = 'groovy.ui.Console'
     classpath = sourceSets.main.runtimeClasspath

http://git-wip-us.apache.org/repos/asf/groovy/blob/7a037562/subprojects/groovy-parser-antlr4/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/build.gradle 
b/subprojects/groovy-parser-antlr4/build.gradle
index a2afecc..54d07a4 100644
--- a/subprojects/groovy-parser-antlr4/build.gradle
+++ b/subprojects/groovy-parser-antlr4/build.gradle
@@ -1,5 +1,3 @@
-if (!rootProject.hasProperty('useAntlr4')) return
-
 apply plugin: 'me.champeau.gradle.antlr4'
 
 def srcBase = "subprojects/groovy-parser-antlr4/src"
@@ -47,13 +45,6 @@ sourceSets.test.java.srcDirs += file("$srcTest/java");
 sourceSets.test.groovy.srcDirs += file("$srcTest/groovy");
 sourceSets.test.resources.srcDirs += file("$srcTest/resources");
 
-
-allprojects {
-   tasks.withType(GroovyCompile) {
-        groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
-    }
-}
-
 test {
     jvmArgs "-Dgroovy.extract.doc.comment=true", 
"-Dgroovy.antlr4.cache.threshold=100"
-}
\ No newline at end of file
+}

Reply via email to