[antlr-interest] importing tokens in Python

edA-qa mort-ora-y e.mortoray at ecircle.com
Thu Jul 31 05:39:33 PDT 2008


edA-qa mort-ora-y wrote:
> In Python if I want to refer to the tokens I need to do an import
> something like this (the only example I could find online did this):
>     from SchemaLexer import (SchemaLexer, ENTITY, DEFAULT, MAPPER,
> PROVIDER )
>
> Is there some way to import all these tokens?  Or better, import them
> inside a class or something, so they don't pollute the main namespace?
>   
I can answer my own question own, something like this works:

    import SchemaLexer as SL;
then use this syntax:
    SL.TOKEN


-- 
edA-qa mort-ora-y
Director Quality Assurance
______________________________________________________
eCircle AG - Inside Digital Marketing
Nymphenburger Str. 86
80636 München

Tel    +49-89-12009-773
Fax    +49-89-12009-750

E-Mail mailto:e.mort-ora-y at ecircle.com
Web    http://www.ecircle.com

______________________________________________________
Aktuelles
"Inside Digital Marketing" - der Newsletter für die
Online-Branche von eCircle. Jeden Monat neu & voll
mit aktuellen Fallstudien und hilfreichen Tipps!
Jetzt kostenlos abonnieren:

http://www.ecircle.com/de/newsletter
______________________________________________________

eCircle AG, HRB 136 334, Handelsregister München
Vorstand:  Lothar Lanz, Volker Wiewer (Vorsitzende), 
Thomas Wilke, Lars Wössner, Alexander Meyer
Vorsitzender des Aufsichtsrates: Dr. Mark Wössner



More information about the antlr-interest mailing list