Dear JFLEX-Users,
I am using JFLEX together with BYACC. It has been working perfectly in all my projects so far.
However, in order to prevent my JFLEX scanner from recognizing a generic quoted string after having recognized a token ISTATUS I have specified the following exclusive lexical start state scenario:
%%
%byaccj
%ignorecase
%xstate ISTATUS_STATE
...
ACTIVE = (active)|([\"](active)[\"])
...
QUOTED_STRING = ([\"][^\n\r]*(\"\")*[^\n\r]*[\"])
%%
...
<ISTATUS_STATE>{ACTIVE} {yyparser.yylval = new ParserVal(yytext()); yybegin(YYINITIAL); return Parser.ACTIVE;}
...
{ISTATUS} {yyparser.yylval = new ParserVal(yytext()); yybegin(ISTATUS_STATE); return Parser.ISTATUS;}
...
{QUOTED_STRING} {yyparser.yylval = new ParserVal(yytext()); return Parser.QUOTED_STRING;}
...
The string that is parsed looks as follows:
... ISTATUS "ACTIVE" ...
I.e. the quoted string "ACTIVE" is directly following the token ISTATUS.
When debugging the lexer I can see that yybegin(ISTATUS_STATE) is set after recognizing the ISTATUS token.
But then the "ACTIVE" string is not recognized and the lexer terminates with zzScanError(ZZ_NO_MATCH) instead;
Without the lexical state spec the ACTIVE token is recognized by the lexer.
Does anyone see where I am wrong in my usage scenario above or would anyone know how to make this work?
Many thanks in advance for your help.
Ralph
|