[antlr-interest] Basic question : howto differantiate value/pair combination
Monty Zukowski
monty at codetransform.com
Fri Jul 30 09:50:01 PDT 2004
Take a look at the documentation on "literals." Also, Terence has
written some tutorials for his class at USF. You should be able to
find them from the antlr.org site.
Monty
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
On Jul 30, 2004, at 1:27 AM, DELZANT Bruno (BMB) wrote:
> Thanks Ric for the answer that helps me.
>
> But now let's suppose that I define the following:
>
> <!--
> class TestLexer extends Lexer;
> options { k=4; }
>
> protected UPPER : ('A'..'Z');
> protected LOWER : ('a'..'z');
> protected LETTER : (LOWER | UPPER);
> protected DIGIT : ('0'..'9');
>
> protected ID : UPPER (LETTER | DIGIT)* ;
> protected VALUE : (LETTER | DIGIT)+ ;
>
> ID_OR_VALUE : (ID EQ) => ID { $setType(ID); }
> | (ID) => VALUE { $setType(VALUE); };
>
> EQ : '=';
> SEPARATOR : ','|';'|' ';
>
> TOKEN_CMD : "LOGIN" | "login"
> | "LOGOUT" | "logout" ;
> -->
>
> I get a lexical nondeterminism between rules ID_OR_VALUE and TOKEN_CMD.
> Is there a way to let know to the lexer that strings defined for
> TOKEN_CMD are tokens and should be considered first by the lexer and if
> not recognised they should be a match with LETTER (ID_OR_VALUE
> indirectly) ?
>
> As general remark I just started 3 days ago discovering ANTLR, it seems
> powerful, but the documentation is, I found, quite vague on basic
> things
> (like the one I speak here).
> Is there any good tutorials that go deeper and deeper that just the
> reference manual ?
>
> Thanks a lot anyway for your support !
>
> Cheers,
> Bruno
>
>
> **** DISCLAIMER ****
>
> "This e-mail and any attachment thereto may contain information which
> is confidential and/or protected by intellectual property rights and
> are intended for the sole use of the recipient(s) named above.
> Any use of the information contained herein (including, but not
> limited to, total or partial reproduction, communication or
> distribution in any form) by other persons than the designated
> recipient(s) is prohibited.
> If you have received this e-mail in error, please notify the sender
> either by telephone or by e-mail and delete the material from any
> computer".
>
> Thank you for your cooperation.
>
> For further information about Proximus mobile phone services please
> see our website at http://www.proximus.be or refer to any Proximus
> agent.
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
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