
org.antlr.v4.test.runtime.templates.FullContextParsing.LoopsSimulateTailRecursion.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.
/*
* Tests predictions for the following case involving closures.
* http://www.antlr.org/wiki/display/~admin/2011/12/29/Flaw+in+ANTLR+v3+LL(*)+analysis+algorithm
*/
TestType() ::= "Parser"
Options ::= [
"Debug": true
]
Grammar ::= [
"T": {}
]
Input() ::= "a(i)\<-x"
Rule() ::= "prog"
Output() ::= <<
pass: a(i)\<-x<\n>
>>
Errors() ::= <<
line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)'
line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)\<-x'<\n>
>>
grammar(grammarName) ::= <<
grammar ;
prog
@init {}
: expr_or_assign*;
expr_or_assign
: expr '++' {}
| expr {}
;
expr: expr_primary ('\<-' ID)?;
expr_primary
: '(' ID ')'
| ID '(' ID ')'
| ID
;
ID : [a-z]+ ;
>>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy