[antlr-interest] Decision can match input such as "DOT ID" using multiple alternative
Lloyd Dupont
ld at galador.net
Fri Jul 13 07:26:38 PDT 2007
The compilers tell me. My problem is it's obvious but it *shouldn't be a problem", how can I make ANTLR be happy?
I have a grammar like that
primary:
(atom -> atom)
(
(LPAREN expressionList RPAREN -> ^(LPAREN $primary expressionList)) // method call
// read object DOT property name
| (DOT ID -> ^(DOT $primary ID))
)*
;
atom:
INT -> ^(CONSTANT INT)
| STRING -> ^(CONSTANT STRING)
identifier -> identifier
;
identifier:
// read identifier or class name
(id0=ID->$id0)
(DOT id1=ID->$(DOT $identifier $id1)) *
((LT identifier GT) => LT id2=identifier GT -> $(GENERIC $identifier $id2))?
now it says there are multiple way to access the tokens ID, and that's true.
howver I assume identifier consume all that it can, and primary will consume only those ID that haven't been consumed by identifier.
(on top of that I generate the same AST in both case...)
Anyway, could some help me to solve this problem?
I need to be able to use ID DOT ID in the 'identifer' property as I need to call this rule in 'LT identifier GT'.
yet I need it in the primary, as I need to access the property of any object....
how can I solve that?!?!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070714/72391add/attachment-0001.html
More information about the antlr-interest
mailing list