[antlr-interest] Lexer confusion

Tom Verbeure hombre at gmail.com
Wed May 26 20:29:11 PDT 2004


Try adding "k=3" to the options section. I think that should work....

Tom


On Wed, 26 May 2004 23:23:05 -0400, franklinchen at cmu.edu
<franklinchen at cmu.edu> wrote:
> 
> The following lexer generates Java code (ANTLR 2.7.4) that does not do
> what I expect.  What am I doing wrong?  What can I do?
> 
> I expect to lex "A-0" as
> 
> WORD HYPHEN NUMBER
> 
> but instead I get an error, because the generated code goes into WORD,
> sees HYPHEN, and then wants an 'A' and bombs out because there isn't
> any.
> 
> ===
> class SampleLexer extends Lexer;
> 
> options {
>        charVocabulary = '\3'..'\377';
> }
> 
> WORD
>    :
>        'A'
>        (
>            HYPHEN
>            'A'
>        )*
>    ;
> 
> HYPHEN
>    :
>        '-'
>    ;
> 
> NUMBER
>    :
>        '0'
>    ;
> 
> --
> Franklin
> 
> 
> 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