I have a lexer rule
LETTER : ('a'..'z')|('A'..'Z');
At a certain point in my parser, I want to know if the next several letters
are the word 'Article'. I don't want an article token, because that word
can appear at other points, and I don't care.
Can I simply define a parser rule
article_string : 'A' 'r' 't' 'i' 'c' 'l' 'e';
If this works, then I'm really confused because I would think that the lexer
would have already decided that there are several LETTER tokens, so I'm not
sure how the parser would see an 'A' and an 'r', etc.
Or should I use a predicate, something like
my_rule : (do the next several letters spell article)? => LETTER LETTER
LETTER etc.
| next alternative
If so, then how exactly do I implement "do the next several letters spell
article" ?
--
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.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address