[antlr-interest] [v3] Rule references in rewrite rules?

David Holroyd dave at badgers-in-foil.co.uk
Mon Aug 21 05:55:24 PDT 2006


Hello,


Should the following do what I think it should..?

  compilationUnit:
          'package' packageBlock -> ^(COMPILATION_UNIT $compilationUnit)
      ;

I was expecting this to give me a result tree which lookes like,

  #( COMPILATION_UNIT 'package' ..etc.. )

but instead I just get,

  #( COMPILATION_UNIT )


Is my syntax wrong, or is $compilationUnit not actually a reference to
the entire pre-rewrite tree for the compilationUnit rule?  (I can't
remember where I read that it should be, any more.)


Thanks for any suggestions!
dave

-- 
http://david.holroyd.me.uk/


More information about the antlr-interest mailing list