Merge remote-tracking branch 'sharwell/lexer-commands'

This commit is contained in:
Sam Harwell 2013-02-23 17:58:58 -06:00
commit 645f80971f
8 changed files with 70 additions and 70 deletions

View File

@ -51,7 +51,7 @@ public class TestCompositeGrammars extends BaseTest {
"import S;\n" +
"s : a ;\n" +
"B : 'b' ;" + // defines B from inherited token space
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "b", debug);
assertEquals("S.a\n", found);
@ -67,7 +67,7 @@ public class TestCompositeGrammars extends BaseTest {
"grammar M;\n" +
"import S;\n" +
"s : a ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "=a", debug);
assertEquals("S.a\n", found);
@ -87,7 +87,7 @@ public class TestCompositeGrammars extends BaseTest {
"import S;\n" +
"s : label=a[3] {System.out.println($label.y);} ;\n" +
"B : 'b' ;" + // defines B from inherited token space
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "b", debug);
assertEquals("S.a1000\n", found);
@ -107,7 +107,7 @@ public class TestCompositeGrammars extends BaseTest {
"import S;\n" +
"s : a {System.out.println($a.text);} ;\n" +
"B : 'b' ;" + // defines B from inherited token space
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "b", debug);
assertEquals("S.ab\n", found);
@ -126,7 +126,7 @@ public class TestCompositeGrammars extends BaseTest {
"grammar M;\n" + // uses no rules from the import
"import S;\n" +
"s : 'b' {foo();} ;\n" + // gS is import pointer
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "b", debug);
assertEquals("foo\n", found);
@ -148,7 +148,7 @@ public class TestCompositeGrammars extends BaseTest {
"import S,T;\n" +
"s : a ;\n" +
"B : 'b' ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "b", debug);
assertEquals("S.a\n", found);
@ -185,7 +185,7 @@ public class TestCompositeGrammars extends BaseTest {
"B : 'b' ;\n" + // another order: B, A, C
"A : 'a' ;\n" +
"C : 'c' ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "aa", debug);
assertEquals("S.x\n" +
@ -214,7 +214,7 @@ public class TestCompositeGrammars extends BaseTest {
"B : 'b' ;\n" + // another order: B, A, C
"A : 'a' ;\n" +
"C : 'c' ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
writeFile(tmpdir, "M.g4", master);
Grammar g = new Grammar(tmpdir+"/M.g4", master, equeue);
@ -241,7 +241,7 @@ public class TestCompositeGrammars extends BaseTest {
"tokens { A, B, C }\n" +
"x : 'x' INT {System.out.println(\"S.x\");} ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
mkdir(tmpdir);
writeFile(tmpdir, "S.g4", slave);
@ -273,7 +273,7 @@ public class TestCompositeGrammars extends BaseTest {
"grammar M;\n" +
"import S;\n" +
"s : x ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
writeFile(tmpdir, "M.g4", master);
Grammar g = new Grammar(tmpdir+"/M.g4", master, equeue);
@ -299,7 +299,7 @@ public class TestCompositeGrammars extends BaseTest {
"grammar M;\n" +
"import S;\n" +
"s : x ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
writeFile(tmpdir, "M.g4", master);
Grammar g = new Grammar(tmpdir+"/M.g4", master, equeue);
@ -317,7 +317,7 @@ public class TestCompositeGrammars extends BaseTest {
"grammar M;\n" +
"import S;\n" +
"b : 'b'|'c' ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"a", "c", debug);
assertEquals("S.a\n", found);
@ -341,7 +341,7 @@ public class TestCompositeGrammars extends BaseTest {
"\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
// for float to work in decl, type must be overridden
String found = execParser("Java.g4", master, "JavaParser", "JavaLexer",
"prog", "float x = 3;", debug);
@ -366,7 +366,7 @@ public class TestCompositeGrammars extends BaseTest {
"grammar M;\n" +
"import S, T;\n" +
"b : 'b'|'c' {System.out.println(\"M.b\");}|B|A ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"a", "c", debug);
assertEquals("M.b\n" +
@ -385,7 +385,7 @@ public class TestCompositeGrammars extends BaseTest {
"lexer grammar M;\n" +
"import S;\n" +
"B : 'b' ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String expecting =
"S.A\n" +
"[@0,0:0='a',<3>,1:0]\n" +
@ -407,7 +407,7 @@ public class TestCompositeGrammars extends BaseTest {
"lexer grammar M;\n" +
"import S;\n" +
"A : 'a' B {System.out.println(\"M.A\");} ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execLexer("M.g4", master, "M", "ab", debug);
assertEquals("M.A\n" +
"[@0,0:1='ab',<1>,1:0]\n" +
@ -429,7 +429,7 @@ public class TestCompositeGrammars extends BaseTest {
"import S;\n" +
"a : A {System.out.println(\"M.a: \"+$A);} ;\n" +
"A : 'abc' {System.out.println(\"M.A\");} ;\n" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"a", "abc", debug);
@ -640,7 +640,7 @@ public class TestCompositeGrammars extends BaseTest {
"@header{package mypackage;}\n" +
"s : a ;\n" +
"B : 'b' ;" + // defines B from inherited token space
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
boolean ok = antlr("M.g4", "M.g4", master, false);
boolean expecting = true; // should be ok
assertEquals(expecting, ok);
@ -658,7 +658,7 @@ public class TestCompositeGrammars extends BaseTest {
"import S;\n" +
"s : a ;\n" +
"B : 'b' ;" +
"WS : (' '|'\\n') {skip();} ;\n" ;
"WS : (' '|'\\n') -> skip ;\n" ;
String found = execParser("M.g4", master, "MParser", "MLexer",
"s", "b", debug);
assertEquals("", found);

View File

@ -51,7 +51,7 @@ public class TestFullContextParsing extends BaseTest {
"@after {dumpDFA();}\n" +
" : ID | ID {;} ;\n" +
"ID : 'a'..'z'+ ;\n"+
"WS : (' '|'\\t'|'\\n')+ {skip();} ;\n";
"WS : (' '|'\\t'|'\\n')+ -> skip ;\n";
String result = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"abc", true);
String expecting =
@ -72,7 +72,7 @@ public class TestFullContextParsing extends BaseTest {
"e : INT | ;\n" +
"ID : 'a'..'z'+ ;\n"+
"INT : '0'..'9'+ ;\n"+
"WS : (' '|'\\t'|'\\n')+ {skip();} ;\n";
"WS : (' '|'\\t'|'\\n')+ -> skip ;\n";
String result = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"$ 34 abc", true);
String expecting =
@ -106,7 +106,7 @@ public class TestFullContextParsing extends BaseTest {
"e : INT | ;\n" +
"ID : 'a'..'z'+ ;\n"+
"INT : '0'..'9'+ ;\n"+
"WS : (' '|'\\t'|'\\n')+ {skip();} ;\n";
"WS : (' '|'\\t'|'\\n')+ -> skip ;\n";
String result = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"$ 34 abc @ 34 abc", true);
String expecting =
@ -132,7 +132,7 @@ public class TestFullContextParsing extends BaseTest {
"e : INT | ;\n" +
"ID : 'a'..'z'+ ;\n"+
"INT : '0'..'9'+ ;\n"+
"WS : (' '|'\\t'|'\\n')+ {skip();} ;\n";
"WS : (' '|'\\t'|'\\n')+ -> skip ;\n";
String result = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"34 abc", true);
String expecting =
@ -157,7 +157,7 @@ public class TestFullContextParsing extends BaseTest {
" | 'return'\n" +
" ;" +
"ID : 'a'..'z'+ ;\n"+
"WS : (' '|'\\t'|'\\n')+ {skip();} ;\n";
"WS : (' '|'\\t'|'\\n')+ -> skip ;\n";
String input = "{ if x then return }";
String result = execParser("T.g4", grammar, "TParser", "TLexer", "s",
input, true);

View File

@ -47,7 +47,7 @@ public class TestLeftRecursion extends BaseTest {
" | ID" +
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
"s", "x", debug);
String expecting = "(s (a x))\n";
@ -72,7 +72,7 @@ public class TestLeftRecursion extends BaseTest {
" | ID" +
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
"s", "x y z", debug);
String expecting = "(s (a (a (a x) y) z))\n";
@ -90,7 +90,7 @@ public class TestLeftRecursion extends BaseTest {
" | ID" +
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"a", "(s (e a) <EOF>)",
"a+b", "(s (e (e a) + (e b)) <EOF>)",
@ -120,7 +120,7 @@ public class TestLeftRecursion extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"a", "(s (e a) <EOF>)",
"1", "(s (e 1) <EOF>)",
@ -193,7 +193,7 @@ public class TestLeftRecursion extends BaseTest {
" ;\n" +
"ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"a|b&c", "(s (e (e a) | (e (e b) & (e c))) <EOF>)",
"(a|b)&c", "(s (e (e ( (e (e a) | (e b)) )) & (e c)) <EOF>)",
@ -224,7 +224,7 @@ public class TestLeftRecursion extends BaseTest {
"e : INT ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"a", "(s (declarator a) <EOF>)",
"*a", "(s (declarator * (declarator a)) <EOF>)",
@ -251,7 +251,7 @@ public class TestLeftRecursion extends BaseTest {
" | '(' x=e ')' {$v = $x.v;}\n" +
" ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"4", "4",
"1+2", "3",
@ -270,7 +270,7 @@ public class TestLeftRecursion extends BaseTest {
" | '(' x=e ')' {}\n" +
" ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"4", "(s (e 4))",
"1*2/3", "(s (e (e (e 1) * (e 2)) / (e 3)))",
@ -296,7 +296,7 @@ public class TestLeftRecursion extends BaseTest {
"\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"4", "4",
"1+2", "3",
@ -318,7 +318,7 @@ public class TestLeftRecursion extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String[] tests = {
"a", "a",
"a+b", "(a+b)",

View File

@ -56,7 +56,7 @@ public class TestLexerExec extends BaseTest {
"lexer grammar L;\n"+
"A : '-' I ;\n" +
"I : '0'..'9'+ ;\n"+
"WS : (' '|'\\n') {skip();} ;";
"WS : (' '|'\\n') -> skip ;";
String found = execLexer("L.g4", grammar, "L", "34 -21 3");
String expecting =
"[@0,0:1='34',<2>,1:0]\n" +
@ -278,7 +278,7 @@ public class TestLexerExec extends BaseTest {
String grammar =
"lexer grammar L;\n"+
"I : ('a' | 'ab') {System.out.println(getText());} ;\n"+
"WS : (' '|'\\n') {skip();} ;\n" +
"WS : (' '|'\\n') -> skip ;\n" +
"J : .;\n";
String found = execLexer("L.g4", grammar, "L", "ab");
String expecting =
@ -292,7 +292,7 @@ public class TestLexerExec extends BaseTest {
String grammar =
"lexer grammar L;\n"+
"I : .*? ('a' | 'ab') {System.out.println(getText());} ;\n"+
"WS : (' '|'\\n') {skip();} ;\n" +
"WS : (' '|'\\n') -> skip ;\n" +
"J : . {System.out.println(getText());};\n";
String found = execLexer("L.g4", grammar, "L", "ab");
String expecting =
@ -308,7 +308,7 @@ public class TestLexerExec extends BaseTest {
String grammar =
"lexer grammar L;\n"+
"I : '0'..'9'+ {System.out.println(\"I\");} ;\n"+
"WS : (' '|'\\n') {skip();} ;";
"WS : (' '|'\\n') -> skip ;";
String found = execLexer("L.g4", grammar, "L", "34 34");
String expecting =
"I\n" +
@ -381,15 +381,15 @@ public class TestLexerExec extends BaseTest {
@Test public void testLexerMode() throws Exception {
String grammar =
"lexer grammar L;\n" +
"STRING_START : '\"' {pushMode(STRING_MODE); more();} ;\n" +
"WS : (' '|'\\n') {skip();} ;\n"+
"STRING_START : '\"' -> pushMode(STRING_MODE), more;\n" +
"WS : (' '|'\\n') -> skip ;\n"+
"mode STRING_MODE;\n"+
"STRING : '\"' {popMode();} ;\n"+
"ANY : . {more();} ;\n";
"STRING : '\"' -> popMode;\n"+
"ANY : . -> more;\n";
String found = execLexer("L.g4", grammar, "L", "\"abc\" \"ab\"");
String expecting =
"[@0,0:4='\"abc\"',<3>,1:0]\n" +
"[@1,6:9='\"ab\"',<3>,1:6]\n" +
"[@0,0:4='\"abc\"',<2>,1:0]\n" +
"[@1,6:9='\"ab\"',<2>,1:6]\n" +
"[@2,10:9='<EOF>',<-1>,1:10]\n";
assertEquals(expecting, found);
}

View File

@ -248,7 +248,7 @@ public class TestParseErrors extends BaseTest {
"CAT : 'cat';\n" +
"HARDWARE: 'hardware';\n" +
"SOFTWARE: 'software';\n" +
"WS : ' ' {skip();} ;" +
"WS : ' ' -> skip ;" +
"acClass\n" +
"@init\n" +
"{ System.out.println(getExpectedTokens().toString(tokenNames)); }\n" +

View File

@ -42,7 +42,7 @@ public class TestSemPredEvalLexer extends BaseTest {
"E1 : 'enum' {false}? ;\n" +
"E2 : 'enum' {true}? ;\n" + // winner not E1 or ID
"ID : 'a'..'z'+ ;\n"+
"WS : (' '|'\\n') {skip();} ;";
"WS : (' '|'\\n') -> skip ;";
String found = execLexer("L.g4", grammar, "L", "enum abc", true);
String expecting =
"[@0,0:3='enum',<2>,1:0]\n" +
@ -63,7 +63,7 @@ public class TestSemPredEvalLexer extends BaseTest {
"lexer grammar L;\n"+
"ENUM : 'enum' {false}? ;\n" +
"ID : 'a'..'z'+ ;\n"+
"WS : (' '|'\\n') {skip();} ;";
"WS : (' '|'\\n') -> skip ;";
String found = execLexer("L.g4", grammar, "L", "enum abc enum", true);
String expecting =
"[@0,0:3='enum',<2>,1:0]\n" +
@ -85,7 +85,7 @@ public class TestSemPredEvalLexer extends BaseTest {
"lexer grammar L;\n"+
"ENUM : [a-z]+ {false}? ;\n" +
"ID : [a-z]+ ;\n"+
"WS : (' '|'\\n') {skip();} ;";
"WS : (' '|'\\n') -> skip ;";
String found = execLexer("L.g4", grammar, "L", "enum abc enum", true);
String expecting =
"[@0,0:3='enum',<2>,1:0]\n" +
@ -101,7 +101,7 @@ public class TestSemPredEvalLexer extends BaseTest {
"lexer grammar L;\n"+
"ENUM : [a-z]+ {getText().equals(\"enum\")}? ;\n" +
"ID : [a-z]+ ;\n"+
"WS : (' '|'\\n') {skip();} ;";
"WS : (' '|'\\n') -> skip ;";
String found = execLexer("L.g4", grammar, "L", "enum abc enum", true);
String expecting =
"[@0,0:3='enum',<1>,1:0]\n" +

View File

@ -46,7 +46,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x", false);
@ -64,7 +64,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"3 4 x", false);
@ -89,7 +89,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x ; y", false);
@ -114,7 +114,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x y 3", false);
@ -139,7 +139,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x y", false);
@ -164,7 +164,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x; y", true);
@ -194,7 +194,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"34; x; y", true);
@ -222,7 +222,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"y 3 x 4", false);
@ -243,7 +243,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
execParser("T.g4", grammar, "TParser", "TLexer", "s",
"y 3 x 4", false);
@ -261,7 +261,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x x y", false);
@ -286,7 +286,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x 4", false);
@ -309,7 +309,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x x y", false);
@ -335,7 +335,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"x x y", false);
@ -366,7 +366,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a b", false);
@ -396,7 +396,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;\n" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a b", false);
@ -417,7 +417,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a;", false);
@ -437,7 +437,7 @@ public class TestSemPredEvalParser extends BaseTest {
" ;" +
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a;", false);
@ -461,7 +461,7 @@ public class TestSemPredEvalParser extends BaseTest {
"e : ID | ;\n" + // non-LL(1) so we use ATN
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a!", false);
@ -487,7 +487,7 @@ public class TestSemPredEvalParser extends BaseTest {
"e : ID | ;\n" + // non-LL(1) so we use ATN
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a!", false);
@ -514,7 +514,7 @@ public class TestSemPredEvalParser extends BaseTest {
"e : ID | ;\n" + // non-LL(1) so we use ATN
"ID : 'a'..'z'+ ;\n" +
"INT : '0'..'9'+;\n" +
"WS : (' '|'\\n') {skip();} ;\n";
"WS : (' '|'\\n') -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s",
"a!", false);

View File

@ -271,7 +271,7 @@ public class TestSets extends BaseTest {
"grammar T;\n" +
"a : (A {System.out.println($A.text);})+ ;\n" +
"A : [AaBb] ;\n" +
"WS : (' '|'\\n')+ {skip();} ;\n";
"WS : (' '|'\\n')+ -> skip ;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
"a", "A a B b", debug);
assertEquals("A\n" +