[antlr-interest] Methods and dynamically scoped variables

Terence Parr parrt at cs.usfca.edu
Mon Oct 29 11:18:00 PDT 2007


On Oct 29, 2007, at 10:21 AM, Christian Andersson wrote:

> Hi all!
>
> I have a lot of java code in my grammar that uses a lot of dynamically
> scoped attributes. Quite often the code look the same using the same
> attributes and so on, this gives me a lot of problem maintaining  
> the code,
> having to change the same value in many places and the code also gets
> unnecessary large.
>
> I really would like to change these long code sequences with  
> methods instead.
> I tried to put @member between @init @after, though no error was  
> reported
> in ANTLRWorks no code was generated to java.

Hi. @name {action} works anywhere and is sent to the target to do  
what it wants (per target). No errors are currently generated.

> Can you only use @members on top of the file using no dynamically  
> scoped
> attributes?

Yes.

Ter



More information about the antlr-interest mailing list