[antlr-interest] Fwd: problem on the grammar of identifier

Jose Ventura jose.ventura.roda at gmail.com
Wed Oct 25 08:59:08 PDT 2006


 Hi Zhiyoung,

I can't test it, but I think the problem is (".current"|"."). This part of
rule is ambiguous with the next part of rule ('a'..'z'), because the string
".current" is right with "." and 'a'..'z', and also with ".current".

I think is better to you to do this test at parser. Maybe with a rule for
the identifier and a tokens 'current' and '.'

Regards
José Ventura



2006/10/25, Zhiyong Zhang <zhiyong_zhang5 at yahoo.ie>:
>
>  Hi,
>
>
> The identifier is supposed to in be the format of "abc.d6f" or "
> abc.current.dg47". I got ambiguity problem with the lookahead =3 in the
> lexical grammar, it also reported problem abc.currentAbcdE. Can anybody
> give me some light?
>
>
>
> IDENTIFIER
> options {testLiterals=true;} : ('a'.. 'z'|'A'..'Z'|'_')( 'a'..'z'|'A'..'Z'
> |'0'..'9'|'_'| ':')*  ( (".current."| ".") ('a'..'z'|'A' ..'Z'|'0'..'9'|'_'
> |':')+)?;
>
>
>
> Thanks in advance.
>
>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061025/c63d533a/attachment.html 


More information about the antlr-interest mailing list