Merge pull request #1760 from parrt/fix-1213

tweak wildcard
This commit is contained in:
Terence Parr 2017-03-15 10:29:08 -07:00 committed by GitHub
commit a872323474
2 changed files with 24 additions and 2 deletions

View File

@ -240,8 +240,30 @@ public class ParserExecDescriptors {
}
/** Match assignments, ignore other tokens with wildcard. */
public static class Wildcard extends BaseParserTestDescriptor {
public String input = "x=10; abc;;;; y=99;";
public String output = "x=10;\ny=99;\n";
public String errors = null;
public String startRule = "a";
public String grammarName = "T";
/**
grammar T;
a : (assign|.)+ EOF ;
assign : ID '=' INT ';' {
<writeln("$text")>
} ;
ID : 'a'..'z'+ ;
INT : '0'..'9'+;
WS : (' '|'\n') -> skip;
*/
@CommentHasStringValue
public String grammar;
}
/**
* This test ensures that {@link ParserATNSimulator} does not produce a
* This test ensures that {@link org.antlr.v4.runtime.atn.ParserATNSimulator} does not produce a
* {@link StackOverflowError} when it encounters an {@code EOF} transition
* inside a closure.
*/

View File

@ -530,7 +530,7 @@ else {
Wildcard(w) ::= <<
this.state = <w.stateNumber>;
<if(w.labels)><w.labels:{l | <labelref(l)> = }><endif>matchWildcard();
<if(w.labels)><w.labels:{l | <labelref(l)> = }><endif>this.matchWildcard();
>>
// ACTION STUFF