I am back.
I've just realized that the ignoring should be done in Parser (not in
Lexer), so I made some adjustments and tried again the construction:
sentence: assignment | macro | other;
other: ~(assignment | macro);
and now I'm getting that the subrule cannot be inverted. Only subrules
of the form:
(T1|T2|T3...) or
('c1'|'c2'|'c3'...)
may be inverted (ranges are also allowed).
So I am back to the same problem:
How do I ignore the other sentences i don't need?
Best regards,
D.H. Bahr.
-------- Original Message --------
Subject: [antlr-interest] Ignoring tokens in AnTLR+Python
Date: Thu, 04 Mar 2010 10:14:23 -0500
From: Daniel Hernandez Bahr <[email protected]>
To: [email protected] <[email protected]>
References:
<[email protected]>
<[email protected]>
<[email protected]>
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.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.