org.antlr.v4.test.runtime.templates.SemPredEvalParser.2UnpredicatedAlts.stg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime-testsuite Show documentation
Show all versions of runtime-testsuite Show documentation
A collection of tests for ANTLR 4 Runtime libraries.
// We have n-2 predicates for n alternatives. pick first alt
TestType() ::= "Parser"
Options ::= [
"Debug": true
]
Grammar ::= [
"T": {}
]
Input() ::= "x; y"
Rule() ::= "s"
Output() ::= <<
alt 1
alt 1<\n>
>>
Errors() ::= <<
line 1:0 reportAttemptingFullContext d=0 (a), input='x'
line 1:0 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='x'
line 1:3 reportAttemptingFullContext d=0 (a), input='y'
line 1:3 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='y'<\n>
>>
grammar(grammarName) ::= <<
grammar ;
s : {} a ';' a; // do 2x: once in ATN, next in DFA
a : ID {}
| ID {}
| {}? ID {}
;
ID : 'a'..'z'+ ;
INT : '0'..'9'+;
WS : (' '|'\n') -> skip ;
>>
© 2015 - 2024 Weber Informatics LLC | Privacy Policy