Lets say I need to run some initialization code everytime I match a rule how can I reduce the redundancy?
rule : TOKEN1 { init(); token1Code(); }
| TOKEN2 { init(); token2Code(); }
;
Also is it possible to do something like
rule : TOKEN1
| TOKEN2
{ codeForToken1OrToken2(); }
;