[antlr-interest] Lexer Character Set Question (ANTLR3.0b6)
Bert Williams
gilbert.williams at prosync.com
Sat Feb 17 07:51:34 PST 2007
Greetings:
Given the following rules abstracted from a larger grammar:
using_rule_1: '$' flag id ')' ;
flag : ( 'U' ) ;
id: (ALPHA)+ ;
using_rule_2 : (ALPHA)+ ;
ALPHA : ('a'..'z'|'A'..'Z' ) ;
I need to understand how to indicate in "using_rule" that other rules that
ALPHA is intended. I believe that I should use a Semantic Predicate, but
can find no way to indicate something like:
" if I am in "using_rule_1", accept as "flag" those characters indicated in
rule "flag". "
i.e.,
The lexer appears to generate different tokes for 'U' and for ALPHA, which
means that in "using_rule_2", I get no matches for 'U' (one of the flags).
This is true even though 'U' is a member of the ALPHA set.
Is this the right direction here or should I consider making "flag" a lexer
rule and modifying ALPHA accordlingly?
Thanks!
Bert Williams.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070217/626c443f/attachment-0001.html
More information about the antlr-interest
mailing list