From: Vern Paxson Date: Mon, 25 Jul 1994 21:21:10 +0000 (+0000) Subject: Bug fix for matching NUL's at end of token when interactive. X-Git-Tag: flex-2-5-5b~206 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a651d14c318823faf2a4742edfa2417b4e0bc67;p=flex Bug fix for matching NUL's at end of token when interactive. yy_flex_strcpy -> yy_flex_strncpy --- diff --git a/gen.c b/gen.c index 09c579d..8e5430f 100644 --- a/gen.c +++ b/gen.c @@ -1048,7 +1048,8 @@ void make_tables() indent_puts( "YY_FATAL_ERROR( \"token too large, exceeds YYLMAX\" ); \\" ); indent_down(); - indent_puts( "yy_flex_strcpy( yytext, yytext_ptr ); \\" ); + indent_puts( + "yy_flex_strncpy( yytext, yytext_ptr, yyleng ); \\" ); } set_indent( 0 ); @@ -1393,7 +1394,7 @@ void make_tables() /* Generate code for handling NUL's, if needed. */ /* First, deal with backing up and setting up yy_cp if the scanner - * finds that it should JAM on the NUL> + * finds that it should JAM on the NUL. */ skelout(); set_indent( 7 ); @@ -1412,6 +1413,13 @@ void make_tables() indent_puts( "yy_current_state = yy_last_accepting_state;" ); } + + else + /* Still need to initialize yy_cp, though + * yy_current_state was set up by + * yy_get_previous_state(). + */ + indent_puts( "yy_cp = yy_c_buf_p;" ); }