[antlr-interest] [WARNING - NOT VIRUS SCANNED] Re: natural-language parsing problem: How to distinguish between special words and regular words
Sven Prevrhal
sprevrha at gmail.com
Mon Feb 9 08:03:03 PST 2009
Markus,
Thanks - almost totally worked! The only thing that needed change was
unit: {IsUnit(input.LT(1).Text)}?=> WORD;
instead of
unit: {IsUnit(input.LA(1).Text)}?=> WORD;
Cheers, Sven
>>> Markus wrote:
I don't know much about your grammar, but if you want to do this then
gated semantic predicates might help:
unit: {IsUnit(input.LA(1).Text)}?=> WORD;
This uses the IsUnit method to decide if the next token is a unit
without taking the token off the token stream. If IsUnit returns false
the unit rule will be invisible to the parser and it will try to find
another rule that matches.
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090209/0f91622a/attachment.html
More information about the antlr-interest
mailing list