diff --git a/tool/test/org/antlr/v4/test/TestFullContextParsing.java b/tool/test/org/antlr/v4/test/TestFullContextParsing.java index 4377de4db..4126e57a3 100644 --- a/tool/test/org/antlr/v4/test/TestFullContextParsing.java +++ b/tool/test/org/antlr/v4/test/TestFullContextParsing.java @@ -55,7 +55,7 @@ public class TestFullContextParsing extends BaseTest { "Decision 0:\n" + "s0-ID->:s1=>1\n"; // not ctx sensitive assertEquals(expecting, result); - assertEquals("line 1:0 reportAmbiguity d=0: ambigAlts={1..2}:[(1,1,[]), (1,2,[])],conflictingAlts={1..2}, input='abc'\n", + assertEquals("line 1:0 reportAmbiguity d=0: ambigAlts={1..2}, input='abc'\n", this.stderrDuringParse); } @@ -77,8 +77,8 @@ public class TestFullContextParsing extends BaseTest { "s0-INT->s1\n" + "s1-ID->s2^\n"; assertEquals(expecting, result); - assertEquals("line 1:5 reportAttemptingFullContext d=1: [(28,1,[18 10]), (20,2,[10])], input='34abc'\n" + - "line 1:2 reportContextSensitivity d=1: [(20,1,[10])],uniqueAlt=1, input='34'\n", + assertEquals("line 1:5 reportAttemptingFullContext d=1, input='34abc'\n" + + "line 1:2 reportContextSensitivity d=1, input='34'\n", this.stderrDuringParse); result = execParser("T.g", grammar, "TParser", "TLexer", "s", @@ -88,8 +88,8 @@ public class TestFullContextParsing extends BaseTest { "s0-INT->s1\n" + "s1-ID->s2^\n"; assertEquals(expecting, result); - assertEquals("line 1:5 reportAttemptingFullContext d=1: [(28,1,[22 14]), (24,2,[14])], input='34abc'\n" + - "line 1:5 reportContextSensitivity d=1: [(1,2,[])],uniqueAlt=2, input='34abc'\n", + assertEquals("line 1:5 reportAttemptingFullContext d=1, input='34abc'\n" + + "line 1:5 reportContextSensitivity d=1, input='34abc'\n", this.stderrDuringParse); } @@ -116,10 +116,10 @@ public class TestFullContextParsing extends BaseTest { "s0-INT->s1\n" + "s1-ID->s2^\n"; assertEquals(expecting, result); - assertEquals("line 1:5 reportAttemptingFullContext d=2: [(30,1,[20 10]), (22,2,[10])], input='34abc'\n" + - "line 1:2 reportContextSensitivity d=2: [(22,1,[10])],uniqueAlt=1, input='34'\n" + - "line 1:14 reportAttemptingFullContext d=2: [(30,1,[24 14]), (26,2,[14])], input='34abc'\n" + - "line 1:14 reportContextSensitivity d=2: [(8,2,[18]), (12,2,[18]), (1,2,[])],uniqueAlt=2, input='34abc'\n", + assertEquals("line 1:5 reportAttemptingFullContext d=2, input='34abc'\n" + + "line 1:2 reportContextSensitivity d=2, input='34'\n" + + "line 1:14 reportAttemptingFullContext d=2, input='34abc'\n" + + "line 1:14 reportContextSensitivity d=2, input='34abc'\n", this.stderrDuringParse); } @@ -161,7 +161,7 @@ public class TestFullContextParsing extends BaseTest { "s0-'else'->:s1=>1\n" + "s0-'}'->:s2=>2\n"; assertEquals(expecting, result); - assertEquals("line 1:29 reportAmbiguity d=1: ambigAlts={1..2}:[(25,1,[]), (25,2,[],up=1)],conflictingAlts={1..2},dipsIntoOuterContext, input='else'\n", + assertEquals("line 1:29 reportAmbiguity d=1: ambigAlts={1..2}, input='else'\n", this.stderrDuringParse); input = "{ if x then return else foo }"; @@ -181,7 +181,7 @@ public class TestFullContextParsing extends BaseTest { // the start of a stat. But, we are using the theory that // SLL(1)=LL(1) and so we are avoiding full context parsing // by declaring all else clause parsing to be ambiguous. - assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}:[(25,1,[]), (25,2,[],up=1)],conflictingAlts={1..2},dipsIntoOuterContext, input='else'\n", + assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}, input='else'\n", this.stderrDuringParse); input = "{ if x then return else foo }"; @@ -195,7 +195,7 @@ public class TestFullContextParsing extends BaseTest { "Decision 1:\n" + "s0-'else'->:s1=>1\n"; assertEquals(expecting, result); - assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}:[(25,1,[]), (25,2,[],up=1)],conflictingAlts={1..2},dipsIntoOuterContext, input='else'\n", + assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}, input='else'\n", this.stderrDuringParse); input = @@ -212,7 +212,7 @@ public class TestFullContextParsing extends BaseTest { "s0-'else'->:s1=>1\n" + "s0-'}'->:s2=>2\n"; assertEquals(expecting, result); - assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}:[(25,1,[]), (25,2,[],up=1)],conflictingAlts={1..2},dipsIntoOuterContext, input='else'\n", + assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}, input='else'\n", this.stderrDuringParse); input = @@ -229,7 +229,7 @@ public class TestFullContextParsing extends BaseTest { "s0-'else'->:s1=>1\n" + "s0-'}'->:s2=>2\n"; assertEquals(expecting, result); - assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}:[(25,1,[]), (25,2,[],up=1)],conflictingAlts={1..2},dipsIntoOuterContext, input='else'\n", + assertEquals("line 1:19 reportAmbiguity d=1: ambigAlts={1..2}, input='else'\n", this.stderrDuringParse); } @@ -259,10 +259,10 @@ public class TestFullContextParsing extends BaseTest { assertEquals("pass.\n", found); String expecting = - "line 1:4 reportAttemptingFullContext d=1: [(35,1,[27 15 8]), (41,1,[27 15 8]), (49,1,[27 15 8]), (35,2,[27 21 8]), (41,2,[27 21 8]), (49,2,[27 21 8])], input='a(i)<-'\n" + - "line 1:7 reportContextSensitivity d=1: [(53,2,[])],uniqueAlt=2, input='a(i)<-x'\n" + - "line 1:3 reportAttemptingFullContext d=3: [(35,1,[27 21 8]), (41,2,[27 21 8]), (49,3,[27 21 8])], input='a(i)'\n" + - "line 1:7 reportAmbiguity d=3: ambigAlts={2..3}:[(53,2,[]), (53,3,[])],conflictingAlts={2..3}, input='a(i)<-x'\n"; + "line 1:4 reportAttemptingFullContext d=1, input='a(i)<-'\n" + + "line 1:7 reportContextSensitivity d=1, input='a(i)<-x'\n" + + "line 1:3 reportAttemptingFullContext d=3, input='a(i)'\n" + + "line 1:7 reportAmbiguity d=3: ambigAlts={2..3}, input='a(i)<-x'\n"; assertEquals(expecting, this.stderrDuringParse); } diff --git a/tool/test/org/antlr/v4/test/TestNonGreedyLoops.java b/tool/test/org/antlr/v4/test/TestNonGreedyLoops.java index 6a5c02432..b4770366f 100644 --- a/tool/test/org/antlr/v4/test/TestNonGreedyLoops.java +++ b/tool/test/org/antlr/v4/test/TestNonGreedyLoops.java @@ -195,7 +195,7 @@ public class TestNonGreedyLoops extends BaseTest { "\n" + "Decision 1:\n" + "s0-INT->:s1=>2\n", found); // resolves INT EOF to alt 1 from s since ambig 'tween a and b - assertEquals("line 1:2 reportAmbiguity d=0: ambigAlts={1..2}:[(1,1,[]), (1,2,[])],conflictingAlts={1..2}, input='34'\n" + + assertEquals("line 1:2 reportAmbiguity d=0: ambigAlts={1..2}, input='34'\n" + "line 1:0 extraneous input '34' expecting \n", this.stderrDuringParse); } @@ -527,11 +527,11 @@ public class TestNonGreedyLoops extends BaseTest { "Decision 3:\n" + "s0-'>'->:s2=>2\n" + "s0-ID->:s1=>1\n", found); - assertEquals("line 1:6 reportAttemptingFullContext d=1: [(20,1,[14 6]), (16,2,[6])], input='foo<'\n" + - "line 1:6 reportAmbiguity d=1: ambigAlts={1..2}:[(26,1,[32 32 32 32 14 6]), (33,1,[14 6]), (22,1,[14 6 10 10]), (26,1,[14 6 10 10]), (33,1,[14 6 10 10]), (20,1,[14 6 10 10 10]), (16,1,[6 10 10 10]), (1,1,[]), (22,2,[14 6 10 10 10 10]), (26,2,[14 6 10 10 10 10]), (33,2,[14 6 10 10 10 10]), (20,2,[14 6 10 10 10 10 10]), (16,2,[6 10 10 10 10 10]), (1,2,[])],conflictingAlts={1..2}, input='foo<'\n" + - "line 1:10 reportAttemptingFullContext d=1: [(20,1,[14 6]), (16,2,[6])], input=''\n" + - "line 1:10 reportAmbiguity d=1: ambigAlts={1..2}:[(35,1,[]), (35,2,[])],conflictingAlts={1..2}, input=''\n" + - "line 1:7 reportAmbiguity d=2: ambigAlts={1..2}:[(26,1,[]), (33,1,[]), (26,2,[]), (33,2,[])],conflictingAlts={1..2}, input='/'\n", + assertEquals("line 1:6 reportAttemptingFullContext d=1, input='foo<'\n" + + "line 1:6 reportAmbiguity d=1: ambigAlts={1..2}, input='foo<'\n" + + "line 1:10 reportAttemptingFullContext d=1, input=''\n" + + "line 1:10 reportAmbiguity d=1: ambigAlts={1..2}, input=''\n" + + "line 1:7 reportAmbiguity d=2: ambigAlts={1..2}, input='/'\n", this.stderrDuringParse); found = execParser("T.g", grammar, "TParser", "TLexer", "s", diff --git a/tool/test/org/antlr/v4/test/TestSemPredEvalParser.java b/tool/test/org/antlr/v4/test/TestSemPredEvalParser.java index a1cf21039..4cb2ab7f9 100644 --- a/tool/test/org/antlr/v4/test/TestSemPredEvalParser.java +++ b/tool/test/org/antlr/v4/test/TestSemPredEvalParser.java @@ -153,7 +153,7 @@ public class TestSemPredEvalParser extends BaseTest { "alt 1\n" + "alt 1\n"; assertEquals(expecting, found); - assertEquals("line 1:0 reportAmbiguity d=0: ambigAlts={1..2}:[(6,1,[],up=1), (1,1,[],up=1), (6,2,[],up=1), (1,2,[],up=1), (6,3,[],{1:0}?,up=1), (1,3,[],{1:0}?,up=1)],hasSemanticContext=true,conflictingAlts={1..3},dipsIntoOuterContext, input='x'\n", + assertEquals("line 1:0 reportAmbiguity d=0: ambigAlts={1..2}, input='x'\n", this.stderrDuringParse); } @@ -184,7 +184,7 @@ public class TestSemPredEvalParser extends BaseTest { "alt 2\n" + "alt 2\n"; assertEquals(expecting, found); - assertEquals("line 1:4 reportAmbiguity d=0: ambigAlts={2..3}:[(6,2,[],up=1), (10,2,[],up=1), (1,2,[],up=1), (6,3,[],up=1), (10,3,[],up=1), (1,3,[],up=1), (6,4,[],{1:0}?,up=1), (10,4,[],{1:0}?,up=1), (1,4,[],{1:0}?,up=1)],hasSemanticContext=true,conflictingAlts={2..4},dipsIntoOuterContext, input='x'\n", + assertEquals("line 1:4 reportAmbiguity d=0: ambigAlts={2..3}, input='x'\n", this.stderrDuringParse); }