@mike-lischke/antlr-tgen
Version:
A generator for antlr-ng runtime test cases
32 lines (25 loc) • 561 B
Plain Text
[notes]
Regular non-forced actions can create side effects used by semantic
predicates and so we cannot evaluate any semantic predicate
encountered after having seen a regular action. This includes
during global follow operations.
[type]
Parser
[grammar]
grammar T;
@parser::members {
<Declare_pred()>
}
s : e {} {<True():Invoke_pred()>}? {<writeln("\"parse\"")>} '!' ;
t : e {} {<False():Invoke_pred()>}? ID ;
e : ID | ; // non-LL(1) so we use ATN
ID : 'a'..'z'+ ;
INT : '0'..'9'+;
WS : (' '|'\n') -> skip ;
[start]
s
[input]
a!
[output]
eval=true
parse