groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: split out LineColumn tests which differ between the old and new parsers (part 3)
Date Fri, 12 May 2017 10:00:23 GMT
Repository: groovy
Updated Branches:
  refs/heads/parrot 2962f895a -> de9d2f1b1


split out LineColumn tests which differ between the old and new parsers (part 3)


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

Branch: refs/heads/parrot
Commit: de9d2f1b1acb6b73944fb6ba591788978451421d
Parents: 2962f89
Author: paulk <paulk@asert.com.au>
Authored: Fri May 12 20:00:13 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Fri May 12 20:00:13 2017 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/ast/LineColumnCheck.txt | 57 -------------------
 .../groovy/ast/LineColumnCheck_antlr2.txt       | 57 +++++++++++++++++++
 .../groovy/ast/LineColumnCheck_antlr4.txt       | 59 +++++++++++++++++++-
 .../apache/groovy/parser/antlr4/AstBuilder.java |  6 +-
 4 files changed, 119 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/de9d2f1b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
index 616d9e8..7895ca1 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
@@ -204,47 +204,6 @@ import static java.lang.Math.*
 import static java.lang.Math.cos
 :::[ClassNode,(1:1),(1:33)]
 
-###declarationWithFullQualifiedTypeName:::
-java.lang.String s = "Groovy"
-:::[ClassNode,(1:1),(1:18)][DeclarationExpression,(1:1),(1:30)][VariableExpression,(1:18),(1:19)]
-
-###typeArgument:::
-Map<String,Object> map
-:::[ClassNode,(1:1),(1:4)];
-[GenericsType,(1:5),(1:11)][ClassNode,(1:5),(1:11)];
-[GenericsType,(1:12),(1:18)][ClassNode,(1:12),(1:18)]
-
-###typeArgumentFullQualifiedTypeName:::
-Map<java.lang.String,java.lang.Object> map
-:::[ClassNode,(1:1),(1:4)][GenericsType,(1:5),(1:21)][ClassNode,(1:5),(1:21)];
-[GenericsType,(1:22),(1:38)][ClassNode,(1:22),(1:38)]
-
-###typeArgumentUpperBound:::
-Collection<? extends File> c
-:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:26)][ClassNode,(-1:-1),(-1:-1)];
-[ClassNode,(1:22),(1:26)]
-
-###typeArgumentLowerBound:::
-Collection<? super File> c
-:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:24)][ClassNode,(-1:-1),(-1:-1)];
-[ClassNode,(1:20),(1:24)]
-
-###typeArgumentsLowerAndUpperBound:::
-Collection<? extends String,? super File> c
-:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:28)][ClassNode,(-1:-1),(-1:-1)][ClassNode,(1:22),(1:28)];
-[GenericsType,(1:29),(1:41)][ClassNode,(-1:-1),(-1:-1)][ClassNode,(1:37),(1:41)]
-
-###typeArgumentNested:::
-class C<Y,T extends Map<String,Map<Y,Integer>>> {}
-:::[ClassNode,(1:1),(1:51)][GenericsType,(1:9),(1:10)][ClassNode,(1:9),(1:10)];
-[GenericsType,(1:11),(1:49)][ClassNode,(1:11),(1:12)][ClassNode,(1:21),(1:49)];
-[GenericsType,(1:25),(1:31)][ClassNode,(1:25),(1:31)][GenericsType,(1:32),(1:49)][ClassNode,(1:32),(1:35)];
-[GenericsType,(1:36),(1:37)][ClassNode,(1:36),(1:37)][GenericsType,(1:38),(1:45)][ClassNode,(1:38),(1:45)]
-
-###typeArugmentInConstructorCall:::
-ArrayList<String> list = new ArrayList<String>()
-:::[ClassNode,(1:30),(1:39)][GenericsType,(1:40),(1:46)][ClassNode,(1:40),(1:46)]
-
 ###castExpressionClassNode:::
 String s = (String)i
 :::[ClassNode,(1:13),(1:19)]
@@ -261,22 +220,6 @@ String s = i as String
 String s = i as java.lang.String
 :::[ClassNode,(1:17),(1:33)]
 
-###PropertyExpressionStaticField:::
-class PropertyExpression {
-    static field
-    static method() {
-        PropertyExpression.field = 42
-    }
-}
-:::[PropertyExpression,(4:9),(4:34)]
-
-###PropertyExpressionNormal:::
-class TestClass {
-    TestClass prop
-}
-TestClass.prop.prop = 42
-:::[PropertyExpression,(4:1),(4:21)][PropertyExpression,(4:1),(4:15)]
-
 ###MethodPointerExpression:::
 def selection = list.find (entry.&validate)
 :::[MethodPointerExpression,(1:28),(1:43)][VariableExpression,(1:28),(1:33)][ConstantExpression,(1:35),(1:43)]

http://git-wip-us.apache.org/repos/asf/groovy/blob/de9d2f1b/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr2.txt
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr2.txt b/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr2.txt
index 5da0000..dd70f0a 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr2.txt
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr2.txt
@@ -174,3 +174,60 @@ def method() throws java.lang.Exception {}
 ###throwsClauseMultiQualifiedName:::
 def method() throws java.lang.Exception, java.lang.RuntimeException {}
 :::[ClassNode,(1:21),(1:40)][ClassNode,(1:42),(1:69)]
+
+###declarationWithFullQualifiedTypeName:::
+java.lang.String s = "Groovy"
+:::[ClassNode,(1:1),(1:18)][DeclarationExpression,(1:1),(1:30)][VariableExpression,(1:18),(1:19)]
+
+###typeArgument:::
+Map<String,Object> map
+:::[ClassNode,(1:1),(1:4)];
+[GenericsType,(1:5),(1:11)][ClassNode,(1:5),(1:11)];
+[GenericsType,(1:12),(1:18)][ClassNode,(1:12),(1:18)]
+
+###typeArgumentFullQualifiedTypeName:::
+Map<java.lang.String,java.lang.Object> map
+:::[ClassNode,(1:1),(1:4)][GenericsType,(1:5),(1:21)][ClassNode,(1:5),(1:21)];
+[GenericsType,(1:22),(1:38)][ClassNode,(1:22),(1:38)]
+
+###typeArgumentUpperBound:::
+Collection<? extends File> c
+:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:26)][ClassNode,(-1:-1),(-1:-1)];
+[ClassNode,(1:22),(1:26)]
+
+###typeArgumentLowerBound:::
+Collection<? super File> c
+:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:24)][ClassNode,(-1:-1),(-1:-1)];
+[ClassNode,(1:20),(1:24)]
+
+###typeArgumentsLowerAndUpperBound:::
+Collection<? extends String,? super File> c
+:::[ClassNode,(1:1),(1:11)][GenericsType,(1:12),(1:28)][ClassNode,(-1:-1),(-1:-1)][ClassNode,(1:22),(1:28)];
+[GenericsType,(1:29),(1:41)][ClassNode,(-1:-1),(-1:-1)][ClassNode,(1:37),(1:41)]
+
+###typeArgumentNested:::
+class C<Y,T extends Map<String,Map<Y,Integer>>> {}
+:::[ClassNode,(1:1),(1:51)][GenericsType,(1:9),(1:10)][ClassNode,(1:9),(1:10)];
+[GenericsType,(1:11),(1:49)][ClassNode,(1:11),(1:12)][ClassNode,(1:21),(1:49)];
+[GenericsType,(1:25),(1:31)][ClassNode,(1:25),(1:31)][GenericsType,(1:32),(1:49)][ClassNode,(1:32),(1:35)];
+[GenericsType,(1:36),(1:37)][ClassNode,(1:36),(1:37)][GenericsType,(1:38),(1:45)][ClassNode,(1:38),(1:45)]
+
+###typeArgumentInConstructorCall:::
+ArrayList<String> list = new ArrayList<String>()
+:::[ClassNode,(1:30),(1:39)][GenericsType,(1:40),(1:46)][ClassNode,(1:40),(1:46)]
+
+###PropertyExpressionStaticField:::
+class PropertyExpression {
+    static field
+    static method() {
+        PropertyExpression.field = 42
+    }
+}
+:::[PropertyExpression,(4:9),(4:34)]
+
+###PropertyExpressionNormal:::
+class TestClass {
+    TestClass prop
+}
+TestClass.prop.prop = 42
+:::[PropertyExpression,(4:1),(4:21)][PropertyExpression,(4:1),(4:15)]

http://git-wip-us.apache.org/repos/asf/groovy/blob/de9d2f1b/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr4.txt
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr4.txt b/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr4.txt
index 2b43cc3..f959523 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr4.txt
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheck_antlr4.txt
@@ -23,7 +23,7 @@ public class Test {
 	String prop = "property"
 }
 :::[FieldNode,(2:2),(2:34)][ConstantExpression,(2:21),(2:22)];
-[FieldNode,(2:24),(2:34)][ConstantExpression,(2:33),(2:34)];
+[FieldNode,(2:2),(2:34)][ConstantExpression,(2:33),(2:34)];
 [FieldNode,(3:2),(3:26)][ConstantExpression,(3:16),(3:26)]
 
 ###ifElse:::
@@ -174,3 +174,60 @@ def method() throws java.lang.Exception {}
 ###throwsClauseMultiQualifiedName:::
 def method() throws java.lang.Exception, java.lang.RuntimeException {}
 :::[ClassNode,(1:21),(1:40)][ClassNode,(1:42),(1:68)]
+
+###declarationWithFullQualifiedTypeName:::
+java.lang.String s = "Groovy"
+:::[ClassNode,(1:1),(1:17)][DeclarationExpression,(1:1),(1:30)][VariableExpression,(1:18),(1:19)]
+
+###typeArgument:::
+Map<String,Object> map
+:::[ClassNode,(1:1),(1:19)];
+[GenericsType,(1:5),(1:11)][ClassNode,(1:5),(1:11)];
+[GenericsType,(1:12),(1:18)][ClassNode,(1:12),(1:18)]
+
+###typeArgumentFullQualifiedTypeName:::
+Map<java.lang.String,java.lang.Object> map
+:::[ClassNode,(1:1),(1:39)][GenericsType,(1:5),(1:21)][ClassNode,(1:5),(1:21)];
+[GenericsType,(1:22),(1:38)][ClassNode,(1:22),(1:38)]
+
+###typeArgumentUpperBound:::
+Collection<? extends File> c
+:::[ClassNode,(1:1),(1:27)][GenericsType,(1:12),(1:26)][ClassNode,(1:12),(1:13)];
+[ClassNode,(1:22),(1:26)]
+
+###typeArgumentLowerBound:::
+Collection<? super File> c
+:::[ClassNode,(1:1),(1:25)][GenericsType,(1:12),(1:24)][ClassNode,(1:12),(1:13)];
+[ClassNode,(1:20),(1:24)]
+
+###typeArgumentsLowerAndUpperBound:::
+Collection<? extends String,? super File> c
+:::[ClassNode,(1:1),(1:42)][GenericsType,(1:12),(1:28)][ClassNode,(1:12),(1:13)][ClassNode,(1:22),(1:28)];
+[GenericsType,(1:29),(1:41)][ClassNode,(1:29),(1:30)][ClassNode,(1:37),(1:41)]
+
+###typeArgumentNested:::
+class C<Y,T extends Map<String,Map<Y,Integer>>> {}
+:::[ClassNode,(1:1),(1:51)][GenericsType,(1:9),(1:10)][ClassNode,(1:9),(1:10)];
+[GenericsType,(1:11),(1:47)][ClassNode,(1:11),(1:47)][ClassNode,(1:21),(1:47)];
+[GenericsType,(1:25),(1:31)][ClassNode,(1:25),(1:31)][GenericsType,(1:32),(1:46)][ClassNode,(1:32),(1:46)];
+[GenericsType,(1:36),(1:37)][ClassNode,(1:36),(1:37)][GenericsType,(1:38),(1:45)][ClassNode,(1:38),(1:45)]
+
+###typeArgumentInConstructorCall:::
+ArrayList<String> list = new ArrayList<String>()
+:::[ClassNode,(1:30),(1:47)][GenericsType,(1:40),(1:46)][ClassNode,(1:40),(1:46)]
+
+###PropertyExpressionStaticField:::
+class PropertyExpression {
+    static field
+    static method() {
+        PropertyExpression.field = 42
+    }
+}
+:::[PropertyExpression,(4:9),(4:33)]
+
+###PropertyExpressionNormal:::
+class TestClass {
+    TestClass prop
+}
+TestClass.prop.prop = 42
+:::[PropertyExpression,(4:1),(4:20)][PropertyExpression,(4:10),(4:15)]

http://git-wip-us.apache.org/repos/asf/groovy/blob/de9d2f1b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index da0222c..9cbc030 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -280,7 +280,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
             if (hasStar) { // e.g. import static java.lang.Math.*
                 String qualifiedName = this.visitQualifiedName(ctx.qualifiedName());
                 ClassNode type = ClassHelper.make(qualifiedName);
-
+                this.configureAST(type, ctx);
 
                 moduleNode.addStaticStarImport(type.getText(), type, annotationNodeList);
 
@@ -298,6 +298,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
                 String alias = hasAlias
                         ? ctx.alias.getText()
                         : name;
+                this.configureAST(classNode, ctx);
 
                 moduleNode.addStaticImport(classNode, name, alias, annotationNodeList);
 
@@ -317,6 +318,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
                 String alias = hasAlias
                         ? ctx.alias.getText()
                         : name;
+                this.configureAST(classNode, ctx);
 
                 moduleNode.addImport(alias, classNode, annotationNodeList);
 
@@ -1172,7 +1174,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object>
implements Groov
     public GenericsType visitTypeParameter(TypeParameterContext ctx) {
         return this.configureAST(
                 new GenericsType(
-                        ClassHelper.make(this.visitClassName(ctx.className())),
+                        this.configureAST(ClassHelper.make(this.visitClassName(ctx.className())),
ctx),
                         this.visitTypeBound(ctx.typeBound()),
                         null
                 ),


Mime
View raw message