Is possible recover the value of a token?
I have a rule that is similar to:
unaryOperation:
NOT { $$ = new UnaryOP(NOT); }
| PLUS { $$ = new UnaryOP(PLUS); }
| MINUS { $$ = new UnaryOP(MINUS); }
;
NOT, PLUS and MINUS are tokens and I am using the generated definition in my program too. Is possible recover this data and not repeat myself in the same line?
I'm not interested in the semantic value, so it is not correct for my write this:
unaryOperation:
NOT { $$ = new UnaryOP($1); }
| PLUS { $$ = new UnaryOP($1); }
| MINUS { $$ = new UnaryOP($1); }
;
Thank you