
org.antlr.v4.test.runtime.templates.ParserExec.PredicatedIfIfElse.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.
/**
* This test is meant to test the expected solution to antlr/antlr4#42.
* https://github.com/antlr/antlr4/issues/42
*/
TestType() ::= "Parser"
Options ::= [
"Debug": true
]
Grammar ::= [
"T": {}
]
Input() ::= "if x if x a else b"
Rule() ::= "s"
Output() ::= ""
Errors() ::= ""
grammar(grammarName) ::= <<
grammar ;
s : stmt EOF ;
stmt : ifStmt | ID;
ifStmt : 'if' ID stmt ('else' stmt | { Parser.ELSE})> }?);
ELSE : 'else';
ID : [a-zA-Z]+;
WS : [ \\n\\t]+ -> skip;
>>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy