[antlr-interest] a question
yjargudo
yjargudo at tiscali.es
Thu Jun 10 01:03:35 PDT 2004
hello,
My question perhaps seems stupid, but I don't have many experience in
antlr.
I have the following rules in an antlr grammar:
keyword:
KEYWORD
;
identifier:
IDENTIFIER
;
IDENTIFIER
: ALPHA (ALPHA|DIGIT)+
(COLON {$setType(KEYWORD); })?
;
COLON
: ':' (EQUALS | UNDERSCORE{ $setType(KEYWORD); })?
;
Now I explain the problem. A keyword is an IDENTIFIER followed by ':'.
I also Can have and ASSIGN that is :
IDENTIFIER := something or IDENTIFIER _ something.
My question is how can I change the rules to force antlr that when it
found an IDENTIFIER ':',it looks the next token to see if it is '='
and then,I'm doing and assignment and not a KEYWORD?
Thank you
Yolanda
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list