Flex lexer start condition not being recognized
I have a scanner that maintains two exclusive states (WORD and DEFN)
%option noyywrap
%s WORD
%s DEFN
%%
%{
BEGIN(WORD);
%}
<WORD>{
"|" { BEGIN(DEFN); return WS_PIPE; }
}
<DEFN>{
[^;]+ { printf("ds: %s\n", yytext); return WD_STRING; }
";" { return WD_SEMICOLON; }
}
\n|. { printf("U: %s\n", yytext); }
%%
But with the simple input "| some text;", when the pipe is parsed, the
state is not being changed, so the parsing of "some text;" fails.
No comments:
Post a Comment