[antlr-interest] Lexer problem

Tom Verbeure hombre at gmail.com
Mon May 24 17:26:57 PDT 2004


I eventually 'solved' this particular rule, but handcoding:

QUOTE: "'" {
    if (LA(1)==....) { $setType(QUOTE); }
    elseif (LA(2)=='\'') { matchNot(EOF_CHAR); match('\'');
$setType(CHAR_LIT); }
    else{ $setType(QUOTE); }
}

Not really an orthodox way, I guess, but it works. 

This being said, the rules itself didn't not solve all lexical problem
with the originally stated problem. However, one major commercial (and
very expensive) VHDL simulator doesn't handle in either, so what's
good enough for them is good enough for me. :-)

Tom



> QUOTE: '\'' (
>    {LA(1)=='(' && LA(2)=='\'' && LA(4)=='\''}? {$setType(QUOTE);}
>    | {LA(2)=='\''}? . "'"                      {$setType(CHAR_LIT};}
>    |                                           {$setType(QUOTE);}
>    ;


 
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