[antlr-interest] Ignoring tokens in AnTLR+Python

Daniel Hernandez Bahr dbahr at estudiantes.uci.cu
Thu Mar 4 07:14:23 PST 2010


Hello everyone!

I am fairly new to AnTLR. I am working on an interpreter for 
configuration files ('configure.ac' files i should say); but I don't 
need to scan every single token on the files, only variable assignments 
and one or another macro so, my question is:

How can I ignore every other sentence on the files?

At first I intended to do something like

SENTENCE: ASSIGNMENT | MACRO | OTHER;
OTHER: ~(ASSIGNMENT | MACRO)

but i get that ~TOKEN is not allowed in lexer. Is there a way to achieve 
this without me having to define the entire grammar of 'configure.ac' files?

Best regards,

D.H. Bahr

PS: As remarked in subject I am using python and not Java or C.


More information about the antlr-interest mailing list