I am trying to do what, in my opinion, is a simple parameter passing the rule in Antlr 3.3:
grammar rule_params; options { output = AST; } rule_params : outer; outer: outer_id '[' inner[$outer_id.tree] ']'; inner[CommonTree parent] : inner_id '[' ']'; outer_id : '#'! ID; inner_id : '$'! ID ; ID : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_' )* ;
So inner[CommonTree parent] generates the following:
inner4=inner((outer_id2!=null?((Object)outer_id2.tree):null));
leads to this error:
The method inner(CommonTree) in the type rule_paramsParser is not applicable for the arguments (Object)
As far as I can tell, this is the same as the example in the Antrl book:
classDefinition[CommonTree mod]
(Kindle Location 3993) - Sorry, I don’t know the page number, but it’s in the middle of the book in chapter 9 of the section with the inscription “Creating nodes with arbitrary actions”.
Thanks for any help.
M
source share