help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

parsing quoted strings help


From: Dub Spencer
Subject: parsing quoted strings help
Date: Fri, 03 Dec 2004 16:53:25 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041103)

hello,

trying to get the contents of a quoted string from lex to bison, I setup these expressions:

<stmt>\"                             BEGIN(qstr); return QUOTE;
<qstr>[^\"\r\n]*                     yylval=yytext; return STRING;
<qstr>\"                             BEGIN(INITIAL); return QUOTE;

so, whenever in a statement a quote occurs, switch to quotedstring mode and match everything except quotes and newlines (dos compatible).

the parser then looks for QUOTE STRING QUOTE and duplicates $2 (yylval is declared char const * to avoid errors) - but this always includes the closing quote. is this the expected behaviour?

thanks for your reply,

peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]