groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Refine the rule for missing right parenthesis(closes #746)
Date Sat, 02 Jun 2018 16:08:40 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 1e0c1a1c3 -> 1047489eb


Refine the rule for missing right parenthesis(closes #746)

(cherry picked from commit 038cef5)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 1047489eb7648fd74dd6178442be09fd00eeb38f
Parents: 1e0c1a1
Author: sunlan <sunlan@apache.org>
Authored: Sun Jun 3 00:05:55 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Sun Jun 3 00:08:34 2018 +0800

----------------------------------------------------------------------
 src/antlr/GroovyParser.g4                 | 5 ++---
 src/test/gls/generics/GenericsTest.groovy | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/1047489e/src/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 3615531..34d3e8d 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -1244,9 +1244,8 @@ keywords
 
 rparen
     :   RPAREN
-    |
-        // !!!Error Alternative, impact the performance of parsing
-        { require(false, "Missing ')'"); }
+    |   r=~RPAREN // !!!Error Alternative
+        { require(false, "Missing ')'", -$r.text.length()); }
     ;
 
 nls

http://git-wip-us.apache.org/repos/asf/groovy/blob/1047489e/src/test/gls/generics/GenericsTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/generics/GenericsTest.groovy b/src/test/gls/generics/GenericsTest.groovy
index 2ff0c10..91746eb 100644
--- a/src/test/gls/generics/GenericsTest.groovy
+++ b/src/test/gls/generics/GenericsTest.groovy
@@ -327,7 +327,7 @@ class GenericsTest extends GenericsTestBase {
     void testGenericsDiamondShortcutIllegalPosition() {
         shouldFailCompilationWithAnyMessage '''
             List<> list4 = []
-        ''', ['unexpected token: <', 'Unexpected input: \'<\'']
+        ''', ['unexpected token: <', 'Unexpected input: \'List<>\'']
     }
 
     void testGenericsInAsType() {
@@ -411,7 +411,7 @@ import java.util.concurrent.atomic.AtomicInteger
 
             shouldFailCompilationWithMessage """
                 def m(Class<Integer someParam) {}
-            """, "Unexpected input: 'Class<Integer someParam'"
+            """, "Unexpected input: '<'"
 
             shouldFailCompilationWithMessage """
                 abstract class ArrayList1<E extends AbstractList<E> implements List<E>
{}


Mime
View raw message