[antlr-interest] one rewrite rule for all alternative literals

Christian chwchw at gmx.de
Tue Oct 25 02:44:38 PDT 2011


Hi community,

I want to use only one rewrite rule for all alternatives within a rule.
Here is an example of what I want to do, but what does not work:

class_modifier
  :
  m=('new'
  | 'public'
  | 'protected'
  | 'internal'
  | 'private'
  | 'abstract'
  | 'sealed'
  | 'static'
  | 'unsafe') -> ^(CLASS_MODIFIER $m)
  ;

Why does this not work and how can I solve my problem?

Greetings,
Christian


More information about the antlr-interest mailing list