[antlr-interest] Rewrite rule problem!

Felix Schmid felix at belugalounge.net
Fri Jul 6 14:35:04 PDT 2007


Hi,

this should work:

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

F.


Liviu U wrote:
> Hi all,
>
>
> 1) I cannot find the syntax for rewriting rule:
>
> class:
>   attr* modif* TK_CLASS '{' ( mtd| fld | prop )* '}'
>
> ->
> if I say
>  ^( TK_CLASS attr* modif*  ( mtd| fld | prop )*  )
>
> I get syntax error, RPAREN expected.
>
> 2) I think there is a bug somewhere, if i put TK_CLASS^ and forget 
> about the rewrite rule,
> in my NodeAdapter the nodes for attr and modif are never bound to 
> NodeClass using AddChild.
> AddChild is never called unless there is a rewrite rule and all nodes 
> follow the root!!!!
>




More information about the antlr-interest mailing list