Preserve scanner state when /include/ing.

This allows /include/s to work when in non-default states,
such as PROPNODECHAR.

We may want to use state stacks to get rid of BEGIN_DEFAULT() altogether...

Signed-off-by: Scott Wood <scottwood@freescale.com>
main
Scott Wood 2008-01-07 14:27:51 -06:00 committed by Jon Loeliger
parent 42107f8bba
commit b1a6719aa6
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@
* USA
*/

%option noyywrap nounput yylineno
%option noyywrap nounput yylineno stack

%x INCLUDE
%x BYTESTRING
@ -55,7 +55,7 @@ static int dts_version; /* = 0 */
%}

%%
<*>"/include/" BEGIN(INCLUDE);
<*>"/include/" yy_push_state(INCLUDE);

<INCLUDE>\"[^"\n]*\" {
yytext[strlen(yytext) - 1] = 0;
@ -63,7 +63,7 @@ static int dts_version; /* = 0 */
/* Some unrecoverable error.*/
exit(1);
}
BEGIN_DEFAULT();
yy_pop_state();
}