[antlr-interest] Custom Token Types (parallel to ASTLabelType, for lexer)?

Ric Klaren klaren at cs.utwente.nl
Thu Oct 28 06:54:10 PDT 2004


On Wed, Oct 20, 2004 at 04:30:23PM -0400, Bryan Ewbank wrote:
> I've looked at the C++ generator, and it appears that RefToken is hardcoded.
> What I would like to do is extend the Token class to include filename
> information, as well as a symbol table reference, but it doesn't seem to be
> a supported model.
> 
> How do others use symbol tables and/or produce file and line information,
> given that the type returned by the Lexer is hardcoded?

It seems noone reported this in the past years. I ran across it while
tinkering with tokenstream filtering for my preprocessor prototype for the
C++ grammar. A recent snapshot should include fixes to the token classes
that make this possible. The C++ parser with preprocessor prototype has all
the code to do the above and a small patch to 2.7.4 to make it possible
(beware very rough code, read the readme).

http://wwwhome.cs.utwente.nl/~klaren/antlr/CPPParser.tar.bz2

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  Quidquid latine dictum sit, altum viditur.
                 (Whatever is said in Latin sounds profound.)



 
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