IDE missed some changed files

This commit is contained in:
Terence Parr 2015-02-14 16:44:35 -08:00
parent 5e70f94628
commit db8de6214e
13 changed files with 206 additions and 231 deletions

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestCompositeLexers extends BaseTest {
@ -23,10 +21,10 @@ public class TestCompositeLexers extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("M.g4", grammar, "M", "abc", false);
assertEquals("S.A\n" +
"[@0,0:0='a',<3>,1:0]\n" +
"[@1,1:1='b',<1>,1:1]\n" +
"[@2,2:2='c',<4>,1:2]\n" +
assertEquals("S.A\n" +
"[@0,0:0='a',<3>,1:0]\n" +
"[@1,1:1='b',<1>,1:1]\n" +
"[@2,2:2='c',<4>,1:2]\n" +
"[@3,3:2='<EOF>',<-1>,1:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -47,8 +45,8 @@ public class TestCompositeLexers extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("M.g4", grammar, "M", "ab", false);
assertEquals("M.A\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
assertEquals("M.A\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:1='<EOF>',<-1>,1:2]\n", found);
assertNull(this.stderrDuringParse);
}

View File

@ -1,11 +1,10 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.test.tool.ErrorQueue;
import org.antlr.v4.tool.Grammar;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestCompositeParsers extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestFullContextParsing extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestLeftRecursion extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestLexerErrors extends BaseTest {
@ -29,7 +27,7 @@ public class TestLexerErrors extends BaseTest {
sb.append("WS : [ \\t\\r\\n]+ -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "[\"foo\"]", false);
assertEquals("[@0,0:6='[\"foo\"]',<1>,1:0]\n" +
assertEquals("[@0,0:6='[\"foo\"]',<1>,1:0]\n" +
"[@1,7:6='<EOF>',<-1>,1:7]\n", found);
assertNull(this.stderrDuringParse);
}
@ -57,7 +55,7 @@ public class TestLexerErrors extends BaseTest {
sb.append("WS : [ \\r\\n\\t]+ -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "{ { } }", false);
assertEquals("[@0,0:6='{ { } }',<1>,1:0]\n" +
assertEquals("[@0,0:6='{ { } }',<1>,1:0]\n" +
"[@1,7:6='<EOF>',<-1>,1:7]\n", found);
assertNull(this.stderrDuringParse);
}
@ -83,7 +81,7 @@ public class TestLexerErrors extends BaseTest {
sb.append("A : 'a' 'b' ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "abx", false);
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
"[@1,3:2='<EOF>',<-1>,1:3]\n", found);
assertEquals("line 1:2 token recognition error at: 'x'\n", this.stderrDuringParse);
}
@ -108,7 +106,7 @@ public class TestLexerErrors extends BaseTest {
sb.append("A : 'a' 'b' ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "abax", false);
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
"[@1,4:3='<EOF>',<-1>,1:4]\n", found);
assertEquals("line 1:2 token recognition error at: 'ax'\n", this.stderrDuringParse);
}
@ -122,8 +120,8 @@ public class TestLexerErrors extends BaseTest {
sb.append("B : 'abc' ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "ababx", false);
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:3='ab',<1>,1:2]\n" +
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:3='ab',<1>,1:2]\n" +
"[@2,5:4='<EOF>',<-1>,1:5]\n", found);
assertEquals("line 1:4 token recognition error at: 'x'\n", this.stderrDuringParse);
}
@ -138,8 +136,8 @@ public class TestLexerErrors extends BaseTest {
sb.append("C : 'abcd' ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "ababcx", false);
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:4='abc',<2>,1:2]\n" +
assertEquals("[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:4='abc',<2>,1:2]\n" +
"[@2,6:5='<EOF>',<-1>,1:6]\n", found);
assertEquals("line 1:5 token recognition error at: 'x'\n", this.stderrDuringParse);
}
@ -167,9 +165,9 @@ public class TestLexerErrors extends BaseTest {
sb.append("ID : [a-z]+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "LLexer", "x : x", false);
assertEquals("[@0,0:0='x',<3>,1:0]\n" +
"[@1,2:2=':',<1>,1:2]\n" +
"[@2,4:4='x',<3>,1:4]\n" +
assertEquals("[@0,0:0='x',<3>,1:0]\n" +
"[@1,2:2=':',<1>,1:2]\n" +
"[@2,4:4='x',<3>,1:4]\n" +
"[@3,5:4='<EOF>',<-1>,1:5]\n", found);
assertEquals("line 1:1 token recognition error at: ' '\nline 1:3 token recognition error at: ' '\n", this.stderrDuringParse);
}

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestLexerExec extends BaseTest {
@ -15,7 +13,7 @@ public class TestLexerExec extends BaseTest {
sb.append("QUOTE : '\"' ; // make sure this compiles\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "\"", false);
assertEquals("[@0,0:0='\"',<1>,1:0]\n" +
assertEquals("[@0,0:0='\"',<1>,1:0]\n" +
"[@1,1:0='<EOF>',<-1>,1:1]\n", found);
assertNull(this.stderrDuringParse);
}
@ -30,9 +28,9 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "34 -21 3", false);
assertEquals("[@0,0:1='34',<2>,1:0]\n" +
"[@1,3:5='-21',<1>,1:3]\n" +
"[@2,7:7='3',<2>,1:7]\n" +
assertEquals("[@0,0:1='34',<2>,1:0]\n" +
"[@1,3:5='-21',<1>,1:3]\n" +
"[@2,7:7='3',<2>,1:7]\n" +
"[@3,8:7='<EOF>',<-1>,1:8]\n", found);
assertNull(this.stderrDuringParse);
}
@ -49,10 +47,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\t] -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "\\ / \\/ /\\", false);
assertEquals("[@0,0:0='\\',<1>,1:0]\n" +
"[@1,2:2='/',<2>,1:2]\n" +
"[@2,4:5='\\/',<3>,1:4]\n" +
"[@3,7:8='/\\',<4>,1:7]\n" +
assertEquals("[@0,0:0='\\',<1>,1:0]\n" +
"[@1,2:2='/',<2>,1:2]\n" +
"[@2,4:5='\\/',<3>,1:4]\n" +
"[@3,7:8='/\\',<4>,1:7]\n" +
"[@4,9:8='<EOF>',<-1>,1:9]\n", found);
assertNull(this.stderrDuringParse);
}
@ -70,8 +68,8 @@ public class TestLexerExec extends BaseTest {
sb.append("SEPARATOR: '!';\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "-.-.-!", false);
assertEquals("[@0,0:4='-.-.-',<1>,1:0]\n" +
"[@1,5:5='!',<3>,1:5]\n" +
assertEquals("[@0,0:4='-.-.-',<1>,1:0]\n" +
"[@1,5:5='!',<3>,1:5]\n" +
"[@2,6:5='<EOF>',<-1>,1:6]\n", found);
assertNull(this.stderrDuringParse);
}
@ -84,8 +82,8 @@ public class TestLexerExec extends BaseTest {
sb.append("STRING : '\"' ('\"\"' | .)*? '\"';\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "\"hi\"\"mom\"", false);
assertEquals("[@0,0:3='\"hi\"',<1>,1:0]\n" +
"[@1,4:8='\"mom\"',<1>,1:4]\n" +
assertEquals("[@0,0:3='\"hi\"',<1>,1:0]\n" +
"[@1,4:8='\"mom\"',<1>,1:4]\n" +
"[@2,9:8='<EOF>',<-1>,1:9]\n", found);
assertNull(this.stderrDuringParse);
}
@ -98,7 +96,7 @@ public class TestLexerExec extends BaseTest {
sb.append("STRING : '\"' ('\"\"' | .)+? '\"';\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "\"\"\"mom\"", false);
assertEquals("[@0,0:6='\"\"\"mom\"',<1>,1:0]\n" +
assertEquals("[@0,0:6='\"\"\"mom\"',<1>,1:0]\n" +
"[@1,7:6='<EOF>',<-1>,1:7]\n", found);
assertNull(this.stderrDuringParse);
}
@ -112,7 +110,7 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\t')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "//blah\n//blah\n", false);
assertEquals("[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" +
assertEquals("[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" +
"[@1,14:13='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -126,8 +124,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\t')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "//blah\n//blah\n", false);
assertEquals("[@0,0:6='//blah\\n',<1>,1:0]\n" +
"[@1,7:13='//blah\\n',<1>,2:0]\n" +
assertEquals("[@0,0:6='//blah\\n',<1>,1:0]\n" +
"[@1,7:13='//blah\\n',<1>,2:0]\n" +
"[@2,14:13='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -141,7 +139,7 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\t')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "//blah\n//blah\n", false);
assertEquals("[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" +
assertEquals("[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" +
"[@1,14:13='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -155,8 +153,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\t')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "//blah\n//blah\n", false);
assertEquals("[@0,0:6='//blah\\n',<1>,1:0]\n" +
"[@1,7:13='//blah\\n',<1>,2:0]\n" +
assertEquals("[@0,0:6='//blah\\n',<1>,1:0]\n" +
"[@1,7:13='//blah\\n',<1>,2:0]\n" +
"[@2,14:13='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -170,7 +168,7 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\t')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "//blah\n//blah\n", false);
assertEquals("[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" +
assertEquals("[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" +
"[@1,14:13='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -184,8 +182,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\t')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "//blah\n//blah\n", false);
assertEquals("[@0,0:6='//blah\\n',<1>,1:0]\n" +
"[@1,7:13='//blah\\n',<1>,2:0]\n" +
assertEquals("[@0,0:6='//blah\\n',<1>,1:0]\n" +
"[@1,7:13='//blah\\n',<1>,2:0]\n" +
"[@2,14:13='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -199,10 +197,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "/* ick */\n/* /* */\n/* /*nested*/ */\n", false);
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,9:9='\\n',<2>,1:9]\n" +
"[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,35:35='\\n',<2>,3:16]\n" +
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,9:9='\\n',<2>,1:9]\n" +
"[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,35:35='\\n',<2>,3:16]\n" +
"[@4,36:35='<EOF>',<-1>,4:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -216,10 +214,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "/* ick */x\n/* /* */x\n/* /*nested*/ */x\n", false);
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,10:10='\\n',<2>,1:10]\n" +
"[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,38:38='\\n',<2>,3:17]\n" +
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,10:10='\\n',<2>,1:10]\n" +
"[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,38:38='\\n',<2>,3:17]\n" +
"[@4,39:38='<EOF>',<-1>,4:0]\n", found);
assertEquals("line 1:9 token recognition error at: 'x'\nline 3:16 token recognition error at: 'x'\n", this.stderrDuringParse);
}
@ -233,10 +231,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "/* ick */\n/* /* */\n/* /*nested*/ */\n", false);
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,9:9='\\n',<2>,1:9]\n" +
"[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,35:35='\\n',<2>,3:16]\n" +
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,9:9='\\n',<2>,1:9]\n" +
"[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,35:35='\\n',<2>,3:16]\n" +
"[@4,36:35='<EOF>',<-1>,4:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -250,10 +248,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "/* ick */x\n/* /* */x\n/* /*nested*/ */x\n", false);
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,10:10='\\n',<2>,1:10]\n" +
"[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,38:38='\\n',<2>,3:17]\n" +
assertEquals("[@0,0:8='/* ick */',<1>,1:0]\n" +
"[@1,10:10='\\n',<2>,1:10]\n" +
"[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" +
"[@3,38:38='\\n',<2>,3:17]\n" +
"[@4,39:38='<EOF>',<-1>,4:0]\n", found);
assertEquals("line 1:9 token recognition error at: 'x'\nline 3:16 token recognition error at: 'x'\n", this.stderrDuringParse);
}
@ -272,11 +270,11 @@ public class TestLexerExec extends BaseTest {
sb.append("J : .;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "ab", false);
assertEquals("stuff0: \n" +
"stuff1: a\n" +
"stuff2: ab\n" +
"ab\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
assertEquals("stuff0: \n" +
"stuff1: a\n" +
"stuff2: ab\n" +
"ab\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:1='<EOF>',<-1>,1:2]\n", found);
assertNull(this.stderrDuringParse);
}
@ -291,8 +289,8 @@ public class TestLexerExec extends BaseTest {
sb.append("J : .;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "ab", false);
assertEquals("ab\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
assertEquals("ab\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
"[@1,2:1='<EOF>',<-1>,1:2]\n", found);
assertNull(this.stderrDuringParse);
}
@ -307,10 +305,10 @@ public class TestLexerExec extends BaseTest {
sb.append("J : . {System.out.println(this.getText());};\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "ab", false);
assertEquals("a\n" +
"b\n" +
"[@0,0:0='a',<1>,1:0]\n" +
"[@1,1:1='b',<3>,1:1]\n" +
assertEquals("a\n" +
"b\n" +
"[@0,0:0='a',<1>,1:0]\n" +
"[@1,1:1='b',<3>,1:1]\n" +
"[@2,2:1='<EOF>',<-1>,1:2]\n", found);
assertNull(this.stderrDuringParse);
}
@ -325,13 +323,13 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "end eend ending a", false);
assertEquals("[@0,0:2='end',<1>,1:0]\n" +
"[@1,3:3=' ',<3>,1:3]\n" +
"[@2,4:7='eend',<2>,1:4]\n" +
"[@3,8:8=' ',<3>,1:8]\n" +
"[@4,9:14='ending',<2>,1:9]\n" +
"[@5,15:15=' ',<3>,1:15]\n" +
"[@6,16:16='a',<2>,1:16]\n" +
assertEquals("[@0,0:2='end',<1>,1:0]\n" +
"[@1,3:3=' ',<3>,1:3]\n" +
"[@2,4:7='eend',<2>,1:4]\n" +
"[@3,8:8=' ',<3>,1:8]\n" +
"[@4,9:14='ending',<2>,1:9]\n" +
"[@5,15:15=' ',<3>,1:15]\n" +
"[@6,16:16='a',<2>,1:16]\n" +
"[@7,17:16='<EOF>',<-1>,1:17]\n", found);
assertNull(this.stderrDuringParse);
}
@ -350,19 +348,19 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : (' '|'\\n')+;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "x 0 1 a.b a.l", false);
assertEquals("[@0,0:0='x',<5>,1:0]\n" +
"[@1,1:1=' ',<6>,1:1]\n" +
"[@2,2:2='0',<2>,1:2]\n" +
"[@3,3:3=' ',<6>,1:3]\n" +
"[@4,4:4='1',<2>,1:4]\n" +
"[@5,5:5=' ',<6>,1:5]\n" +
"[@6,6:6='a',<5>,1:6]\n" +
"[@7,7:7='.',<4>,1:7]\n" +
"[@8,8:8='b',<5>,1:8]\n" +
"[@9,9:9=' ',<6>,1:9]\n" +
"[@10,10:10='a',<5>,1:10]\n" +
"[@11,11:11='.',<4>,1:11]\n" +
"[@12,12:12='l',<5>,1:12]\n" +
assertEquals("[@0,0:0='x',<5>,1:0]\n" +
"[@1,1:1=' ',<6>,1:1]\n" +
"[@2,2:2='0',<2>,1:2]\n" +
"[@3,3:3=' ',<6>,1:3]\n" +
"[@4,4:4='1',<2>,1:4]\n" +
"[@5,5:5=' ',<6>,1:5]\n" +
"[@6,6:6='a',<5>,1:6]\n" +
"[@7,7:7='.',<4>,1:7]\n" +
"[@8,8:8='b',<5>,1:8]\n" +
"[@9,9:9=' ',<6>,1:9]\n" +
"[@10,10:10='a',<5>,1:10]\n" +
"[@11,11:11='.',<4>,1:11]\n" +
"[@12,12:12='l',<5>,1:12]\n" +
"[@13,13:12='<EOF>',<-1>,1:13]\n", found);
assertNull(this.stderrDuringParse);
}
@ -376,7 +374,7 @@ public class TestLexerExec extends BaseTest {
sb.append("A : 'a';\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "", false);
assertEquals("[@0,0:-1='<EOF>',<1>,1:0]\n" +
assertEquals("[@0,0:-1='<EOF>',<1>,1:0]\n" +
"[@1,0:-1='<EOF>',<-1>,1:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -405,7 +403,7 @@ public class TestLexerExec extends BaseTest {
sb.append("C : 'c';\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "a", false);
assertEquals("[@0,0:0='a',<1>,1:0]\n" +
assertEquals("[@0,0:0='a',<1>,1:0]\n" +
"[@1,1:0='<EOF>',<-1>,1:1]\n", found);
assertNull(this.stderrDuringParse);
}
@ -419,10 +417,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\u000D] -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "34\n 34", false);
assertEquals("I\n" +
"I\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,4:5='34',<1>,2:1]\n" +
assertEquals("I\n" +
"I\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,4:5='34',<1>,2:1]\n" +
"[@2,6:5='<EOF>',<-1>,2:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -436,10 +434,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\u000D]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "34\n 34", false);
assertEquals("I\n" +
"I\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,4:5='34',<1>,2:1]\n" +
assertEquals("I\n" +
"I\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,4:5='34',<1>,2:1]\n" +
"[@2,6:5='<EOF>',<-1>,2:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -453,8 +451,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\u000D]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "xaf", false);
assertEquals("I\n" +
"[@0,0:2='xaf',<1>,1:0]\n" +
assertEquals("I\n" +
"[@0,0:2='xaf',<1>,1:0]\n" +
"[@1,3:2='<EOF>',<-1>,1:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -469,10 +467,10 @@ public class TestLexerExec extends BaseTest {
sb.append(" \n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "a x", false);
assertEquals("I\n" +
"I\n" +
"[@0,0:0='a',<1>,1:0]\n" +
"[@1,2:2='x',<1>,1:2]\n" +
assertEquals("I\n" +
"I\n" +
"[@0,0:0='a',<1>,1:0]\n" +
"[@1,2:2='x',<1>,1:2]\n" +
"[@2,3:2='<EOF>',<-1>,1:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -487,14 +485,14 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\u0009\\r]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "34\n 34 a2 abc \n ", false);
assertEquals("I\n" +
"I\n" +
"ID\n" +
"ID\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,4:5='34',<1>,2:1]\n" +
"[@2,7:8='a2',<2>,2:4]\n" +
"[@3,10:12='abc',<2>,2:7]\n" +
assertEquals("I\n" +
"I\n" +
"ID\n" +
"ID\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,4:5='34',<1>,2:1]\n" +
"[@2,7:8='a2',<2>,2:4]\n" +
"[@3,10:12='abc',<2>,2:7]\n" +
"[@4,18:17='<EOF>',<-1>,3:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -508,8 +506,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\u000D]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "00\n", false);
assertEquals("I\n" +
"[@0,0:1='00',<1>,1:0]\n" +
assertEquals("I\n" +
"[@0,0:1='00',<1>,1:0]\n" +
"[@1,3:2='<EOF>',<-1>,2:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -523,8 +521,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\u]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "34 ", false);
assertEquals("I\n" +
"[@0,0:1='34',<1>,1:0]\n" +
assertEquals("I\n" +
"[@0,0:1='34',<1>,1:0]\n" +
"[@1,3:2='<EOF>',<-1>,1:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -538,10 +536,10 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\u]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "- ] ", false);
assertEquals("DASHBRACK\n" +
"DASHBRACK\n" +
"[@0,0:0='-',<1>,1:0]\n" +
"[@1,2:2=']',<1>,1:2]\n" +
assertEquals("DASHBRACK\n" +
"DASHBRACK\n" +
"[@0,0:0='-',<1>,1:0]\n" +
"[@1,2:2=']',<1>,1:2]\n" +
"[@2,4:3='<EOF>',<-1>,1:4]\n", found);
assertNull(this.stderrDuringParse);
}
@ -555,8 +553,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\u]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "9", false);
assertEquals("A\n" +
"[@0,0:0='9',<1>,1:0]\n" +
assertEquals("A\n" +
"[@0,0:0='9',<1>,1:0]\n" +
"[@1,1:0='<EOF>',<-1>,1:1]\n", found);
assertNull(this.stderrDuringParse);
}
@ -570,8 +568,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\t]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "b\"a", false);
assertEquals("A\n" +
"[@0,0:2='b\"a',<1>,1:0]\n" +
assertEquals("A\n" +
"[@0,0:2='b\"a',<1>,1:0]\n" +
"[@1,3:2='<EOF>',<-1>,1:3]\n", found);
assertNull(this.stderrDuringParse);
}
@ -585,8 +583,8 @@ public class TestLexerExec extends BaseTest {
sb.append("WS : [ \\n\\t]+ -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "b\"\\a", false);
assertEquals("A\n" +
"[@0,0:3='b\"\\a',<1>,1:0]\n" +
assertEquals("A\n" +
"[@0,0:3='b\"\\a',<1>,1:0]\n" +
"[@1,4:3='<EOF>',<-1>,1:4]\n", found);
assertNull(this.stderrDuringParse);
}
@ -710,15 +708,15 @@ public class TestLexerExec extends BaseTest {
sb.append(" ;\n");
String grammar = sb.toString();
String found = execLexer("PositionAdjustingLexer.g4", grammar, "PositionAdjustingLexer", "tokens\ntokens {\nnotLabel\nlabel1 =\nlabel2 +=\nnotLabel\n", false);
assertEquals("[@0,0:5='tokens',<6>,1:0]\n" +
"[@1,7:12='tokens',<4>,2:0]\n" +
"[@2,14:14='{',<3>,2:7]\n" +
"[@3,16:23='notLabel',<6>,3:0]\n" +
"[@4,25:30='label1',<5>,4:0]\n" +
"[@5,32:32='=',<1>,4:7]\n" +
"[@6,34:39='label2',<5>,5:0]\n" +
"[@7,41:42='+=',<2>,5:7]\n" +
"[@8,44:51='notLabel',<6>,6:0]\n" +
assertEquals("[@0,0:5='tokens',<6>,1:0]\n" +
"[@1,7:12='tokens',<4>,2:0]\n" +
"[@2,14:14='{',<3>,2:7]\n" +
"[@3,16:23='notLabel',<6>,3:0]\n" +
"[@4,25:30='label1',<5>,4:0]\n" +
"[@5,32:32='=',<1>,4:7]\n" +
"[@6,34:39='label2',<5>,5:0]\n" +
"[@7,41:42='+=',<2>,5:7]\n" +
"[@8,44:51='notLabel',<6>,6:0]\n" +
"[@9,53:52='<EOF>',<-1>,7:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -4731,7 +4729,7 @@ public class TestLexerExec extends BaseTest {
sb.append("KW3999 : 'KW' '3999';\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "KW400", false);
assertEquals("[@0,0:4='KW400',<402>,1:0]\n" +
assertEquals("[@0,0:4='KW400',<402>,1:0]\n" +
"[@1,5:4='<EOF>',<-1>,1:5]\n", found);
assertNull(this.stderrDuringParse);
}
@ -4751,7 +4749,7 @@ public class TestLexerExec extends BaseTest {
sb.append(" EndString : '\\'' -> popMode;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "'xxx'", false);
assertEquals("[@0,0:4=''xxx'',<1>,1:0]\n" +
assertEquals("[@0,0:4=''xxx'',<1>,1:0]\n" +
"[@1,5:4='<EOF>',<-1>,1:5]\n", found);
assertNull(this.stderrDuringParse);
}

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestListeners extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestParseTrees extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestParserErrors extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestParserExec extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestSemPredEvalLexer extends BaseTest {
@ -18,15 +16,15 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "enum abc", true);
assertEquals("[@0,0:3='enum',<2>,1:0]\n" +
"[@1,5:7='abc',<3>,1:5]\n" +
"[@2,8:7='<EOF>',<-1>,1:8]\n" +
"s0-' '->:s5=>4\n" +
"s0-'a'->:s6=>3\n" +
"s0-'e'->:s1=>3\n" +
":s1=>3-'n'->:s2=>3\n" +
":s2=>3-'u'->:s3=>3\n" +
":s6=>3-'b'->:s6=>3\n" +
assertEquals("[@0,0:3='enum',<2>,1:0]\n" +
"[@1,5:7='abc',<3>,1:5]\n" +
"[@2,8:7='<EOF>',<-1>,1:8]\n" +
"s0-' '->:s5=>4\n" +
"s0-'a'->:s6=>3\n" +
"s0-'e'->:s1=>3\n" +
":s1=>3-'n'->:s2=>3\n" +
":s2=>3-'u'->:s3=>3\n" +
":s6=>3-'b'->:s6=>3\n" +
":s6=>3-'c'->:s6=>3\n", found);
assertNull(this.stderrDuringParse);
}
@ -41,16 +39,16 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "enum abc enum", true);
assertEquals("[@0,0:3='enum',<2>,1:0]\n" +
"[@1,5:7='abc',<2>,1:5]\n" +
"[@2,9:12='enum',<2>,1:9]\n" +
"[@3,13:12='<EOF>',<-1>,1:13]\n" +
"s0-' '->:s5=>3\n" +
"s0-'a'->:s4=>2\n" +
"s0-'e'->:s1=>2\n" +
":s1=>2-'n'->:s2=>2\n" +
":s2=>2-'u'->:s3=>2\n" +
":s4=>2-'b'->:s4=>2\n" +
assertEquals("[@0,0:3='enum',<2>,1:0]\n" +
"[@1,5:7='abc',<2>,1:5]\n" +
"[@2,9:12='enum',<2>,1:9]\n" +
"[@3,13:12='<EOF>',<-1>,1:13]\n" +
"s0-' '->:s5=>3\n" +
"s0-'a'->:s4=>2\n" +
"s0-'e'->:s1=>2\n" +
":s1=>2-'n'->:s2=>2\n" +
":s2=>2-'u'->:s3=>2\n" +
":s4=>2-'b'->:s4=>2\n" +
":s4=>2-'c'->:s4=>2\n", found);
assertNull(this.stderrDuringParse);
}
@ -65,10 +63,10 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "enum abc enum", true);
assertEquals("[@0,0:3='enum',<2>,1:0]\n" +
"[@1,5:7='abc',<2>,1:5]\n" +
"[@2,9:12='enum',<2>,1:9]\n" +
"[@3,13:12='<EOF>',<-1>,1:13]\n" +
assertEquals("[@0,0:3='enum',<2>,1:0]\n" +
"[@1,5:7='abc',<2>,1:5]\n" +
"[@2,9:12='enum',<2>,1:9]\n" +
"[@3,13:12='<EOF>',<-1>,1:13]\n" +
"s0-' '->:s2=>3\n", found);
assertNull(this.stderrDuringParse);
}
@ -83,10 +81,10 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "enum abc enum", true);
assertEquals("[@0,0:3='enum',<1>,1:0]\n" +
"[@1,5:7='abc',<2>,1:5]\n" +
"[@2,9:12='enum',<1>,1:9]\n" +
"[@3,13:12='<EOF>',<-1>,1:13]\n" +
assertEquals("[@0,0:3='enum',<1>,1:0]\n" +
"[@1,5:7='abc',<2>,1:5]\n" +
"[@2,9:12='enum',<1>,1:9]\n" +
"[@3,13:12='<EOF>',<-1>,1:13]\n" +
"s0-' '->:s3=>3\n", found);
assertNull(this.stderrDuringParse);
}
@ -103,21 +101,21 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : [ \\t]+ ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "abc\n def \n", true);
assertEquals("INDENT\n" +
"[@0,0:2='abc',<1>,1:0]\n" +
"[@1,3:3='\\n',<3>,1:3]\n" +
"[@2,4:5=' ',<2>,2:0]\n" +
"[@3,6:8='def',<1>,2:2]\n" +
"[@4,9:10=' ',<4>,2:5]\n" +
"[@5,11:11='\\n',<3>,2:7]\n" +
"[@6,12:11='<EOF>',<-1>,3:0]\n" +
"s0-'\n" +
"'->:s2=>3\n" +
"s0-'a'->:s1=>1\n" +
"s0-'d'->:s1=>1\n" +
":s1=>1-'b'->:s1=>1\n" +
":s1=>1-'c'->:s1=>1\n" +
":s1=>1-'e'->:s1=>1\n" +
assertEquals("INDENT\n" +
"[@0,0:2='abc',<1>,1:0]\n" +
"[@1,3:3='\\n',<3>,1:3]\n" +
"[@2,4:5=' ',<2>,2:0]\n" +
"[@3,6:8='def',<1>,2:2]\n" +
"[@4,9:10=' ',<4>,2:5]\n" +
"[@5,11:11='\\n',<3>,2:7]\n" +
"[@6,12:11='<EOF>',<-1>,3:0]\n" +
"s0-'\n" +
"'->:s2=>3\n" +
"s0-'a'->:s1=>1\n" +
"s0-'d'->:s1=>1\n" +
":s1=>1-'b'->:s1=>1\n" +
":s1=>1-'c'->:s1=>1\n" +
":s1=>1-'e'->:s1=>1\n" +
":s1=>1-'f'->:s1=>1\n", found);
assertNull(this.stderrDuringParse);
}
@ -134,14 +132,14 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : (' '|'\\n') -> skip;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "a cde\nabcde\n", true);
assertEquals("a\n" +
"cde\n" +
"ab\n" +
"cde\n" +
"[@0,0:0='a',<1>,1:0]\n" +
"[@1,2:4='cde',<2>,1:2]\n" +
"[@2,6:7='ab',<1>,2:0]\n" +
"[@3,8:10='cde',<2>,2:2]\n" +
assertEquals("a\n" +
"cde\n" +
"ab\n" +
"cde\n" +
"[@0,0:0='a',<1>,1:0]\n" +
"[@1,2:4='cde',<2>,1:2]\n" +
"[@2,6:7='ab',<1>,2:0]\n" +
"[@3,8:10='cde',<2>,2:2]\n" +
"[@4,12:11='<EOF>',<-1>,3:0]\n", found);
assertNull(this.stderrDuringParse);
}
@ -156,12 +154,12 @@ public class TestSemPredEvalLexer extends BaseTest {
sb.append("WS : [ \\n] -> skip ;\n");
String grammar = sb.toString();
String found = execLexer("L.g4", grammar, "L", "enum enu a", false);
assertEquals("enum!\n" +
"ID enu\n" +
"ID a\n" +
"[@0,0:3='enum',<1>,1:0]\n" +
"[@1,5:7='enu',<2>,1:5]\n" +
"[@2,9:9='a',<2>,1:9]\n" +
assertEquals("enum!\n" +
"ID enu\n" +
"ID a\n" +
"[@0,0:3='enum',<1>,1:0]\n" +
"[@1,5:7='enu',<2>,1:5]\n" +
"[@2,9:9='a',<2>,1:9]\n" +
"[@3,10:9='<EOF>',<-1>,1:10]\n", found);
assertNull(this.stderrDuringParse);
}

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestSemPredEvalParser extends BaseTest {

View File

@ -1,9 +1,7 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class TestSets extends BaseTest {