Code Comments
Programming Forum and web based access to our favorite programming groups.I have a flex scanner that has the following patterns (among others,
obviously):
<INITIAL>foo BEGIN(state1);
<INITIAL>bar BEGIN(state2);
<state1>token1 yylval.val = yytext; return TOK_TOKEN1;
<state2>token2 yylval.val = yytext; return TOK_TOKEN2;
<*><<EOF>> yyterminate();
<*>.|\n { char s[256];
sprintf(s,"Error at char '%s'\n",yytext);
error(s); }
What I do not understand is why that final rule never executes. I'm
using the "-s" option to flex, and getting "syntax error" instead of
my custom message from above.
[Most likely because <*> isn't a valid start state in any versioon of lex
I'm familiar with. -John]
Post Follow-up to this messageHello! Aaron Sherman <AaronJSherman@gmail.com> wrote: >[...] >[Most likely because <*> isn't a valid start state in any versioon of lex >I'm familiar with. -John] The flex manpage says: <*>r An `r' in any start condition, even an exclusive one. Kind regards, Hannah. [Oh, look, you're right. I've had a lot of trouble with flex start states. I think there are lurking bugs. -John]
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.