[antlr-interest] Converting ANTLR-Lexer to FLEX

Ric Klaren ric.klaren at gmail.com
Mon Dec 6 07:03:45 PST 2004


Hi,

On Mon, 06 Dec 2004 03:26:33 +0200, Serg <sun2 at public.kherson.ua> wrote:
> I have such ANTLR-lexer rule:
> 
> STRING_LITERAL
>     :   QUOTE!
>             ( ~('\'')
>             | ( QUOTE QUOTE! )
>             )*
>         QUOTE!
>     ;
> 
> How can I write this rule on the Flex?
> I can't understand how to do this operation (QUOTE!) in the Flex.

You normally use a lexer state for inside the string. The
examples/cpp/flexLexer example from the distribution has a lexer that
has a way to do this in flex/lex. It might be that this example was
not yet updated in the 2.7.4 release in that case pickup a snapshot
from http://wwwhome.cs.utwente.nl/~klaren/antlr/ that one should have
it I think. Or drop me a line personally and I'll send the .l file to
you.

Cheers,

Ric


 
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