Reputation: 155
i am writing a grammar in ANTLR and i want to make a question about return values. I have this rule:
mainParser returns [int test]
:
triple EOF
{
$test = 0;
}
;
When i call it from generated java code i can't take back the test value, because it returns me a "parser object":
How to make it to return Integer, String etc. ?
Upvotes: 1
Views: 157
Reputation: 5962
Since mainParser must return a tree and an int, it must use an object. That mainParser_return object has both, if you look inside.
Upvotes: 2