[antlr-interest] Rewrite rule problem!

Diehl, Matthew J matthew.j.diehl at intel.com
Fri Jul 6 15:30:03 PDT 2007


>> class:
>>   attr* modif* TK_CLASS '{' ( mtd| fld | prop )* '}'
>>     -> ^( TK_CLASS attr* modif*  mtd* fld* prop*  )
>
>But doing that will eradicate the ordering of the mtd, fld and props as
>they appeared in the original input, putting all the mtds first, then
>all the flds and last all the props.
>

Could you then just do it with a mix of the two ways:

class:
  attr* modif* TK_CLASS '{' ( mtd| fld | prop )* '}'
    -> ^( TK_CLASS attr* modif*  (mtd? fld? prop?)*  )


More information about the antlr-interest mailing list