[antlr-interest] Re: ANTLR for Python

Ric Klaren klaren at cs.utwente.nl
Tue Nov 16 05:22:34 PST 2004


On Mon, Nov 15, 2004 at 10:27:31PM -0000, Marq Kole wrote:
> Therefore my request for how to make specific headers:
> - header "init" { } is needed, but I do not actually need separate
>   preinit and postinit, I guess. Otherwise it would be:
> - header "preinit" { } and
> - header "postinit" { }
> - header { } is necessary as well, but that's already available.
> - header "post" { } would be needed to add any code after the
>   generated parser/lexer/treeparser class, for instance for self
>   testing.

AFAIK there's no testing on the named headers they just get added in a
hashmap. So you should be able to directly put one or more in the .g files.
In the codegenerator you can call behavior.headerActions.get("init") to get
the token for the complete action text (see printHeader in
CppCodegenerator.java)

After that it's just a matter of plugging them where they need to go.

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  "Of all the things I've lost I miss my mind the most --- Ozzy Osbourne



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list