[antlr-interest] AntLR Bug
Stdiobe
stdiobe at enneya.com
Tue Feb 5 07:35:42 PST 2002
Michael,
> This is the simplified example that fails to work with AntLR. I don't see
> any additional opportunity for left-factoring here.
I checked your original example dated february 3, and based on that
I would like to suggest following approach (although I haven't tested
this, and it might produce the same problems, but I don't expect so).
NAME_OR_END_TOKEN
: (NAME_TOKEN_lookahead)=> NAME_TOKEN {setType(...);}
| END_TOKEN {setType(...);}
;
protected NAME_TOKEN
: GRAPHIC_TOKEN
;
protected NAME_TOKEN_lookahead
: GRAPHIC_TOKEN_lookahead
;
protected GRAPHIC_TOKEN
: END_CHAR (GRAPHIC_TOKEN_CHAR|END_CHAR)+
| GRAPHIC_TOKEN_CHAR
(GRAPHIC_TOKEN_CHAR|END_CHAR)*
;
protected GRAPHIC_TOKEN_lookahead
: END_CHAR (GRAPH_TOKEN_CHAR|END_CHAR)
| GRAPHIC_TOKEN_CHAR
;
protected NAME_TOKEN_lookahead:
: END_CHAR GRAPHIC_TOKEN_CHAR
protected END_TOKEN
: END_CHAR
;
Good luck, Stdiobe
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list