The question is about how to get access to current tree node inside {"action"}
block in the grammar.
I'm talking about Java
target, so inside generated rule-method I'd like to gain access to object root_1
(see below, standard generated code, SUBJECT
here is the token inside my grammar, it doesn't matter):
{
Object root_1 = (Object)adaptor.nil();
root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(SUBJECT, "SUBJECT"), root_1);
adaptor.addChild(root_1, stream_noun.nextTree());
adaptor.addChild(root_0, root_1);
}
Inside grammar I'd like to have an ability to do something like:
subject : noun -> ^(SUBJECT noun) { ... place code here to work with `root_1` object ... } ;
Could somebody suggest any idea? Thanks.