[antlr-interest] Newbie: Simple Parser production error

Nico nico123 at adinet.com.uy
Sun Oct 26 15:58:37 PST 2003


hi all:

What happens if I have 2 rules starting with the same rule as follows:

ident: (LETTER)+; //(A..Z)+

symbol:
      ident "#" ident
;

keyword:
      ident ":"
;

We can factor to a new rule:

newRule: ident ("#" ident | ":" );

But If I have a rule that uses keyword (ruleUseKeyword), I have to modify it as

ruleUseKeyword: newRule "something";

Therefore, an invalid entry starting with "A#A" (previously identified as symbol)
will be identified by ruleUseKeyword. And only entries like A:A should be the ones..

What im doing wrong?

regards


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20031026/96b6634b/attachment.html


More information about the antlr-interest mailing list