From: Vern Paxson Date: Sat, 25 May 1996 15:26:38 +0000 (+0000) Subject: snapshot of cscope yymore fixes, prior to switching yymore-on-%array approach X-Git-Tag: flex-2-5-5b~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7eedc86cae6522448d88e49ffb583955425a8dd;p=flex snapshot of cscope yymore fixes, prior to switching yymore-on-%array approach --- diff --git a/flex.skl b/flex.skl index 218e652..e6ebec8 100644 --- a/flex.skl +++ b/flex.skl @@ -749,7 +749,7 @@ int yyFlexLexer::yy_get_next_buffer() { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { - /* We matched a singled characater, the EOB, so + /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; @@ -985,7 +985,7 @@ int yyFlexLexer::yyinput() else { /* need more input */ - yytext_ptr = yy_c_buf_p; + int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) @@ -994,8 +994,7 @@ int yyFlexLexer::yyinput() { if ( yywrap() ) { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; + yy_c_buf_p = yytext_ptr + offset; return EOF; } @@ -1009,7 +1008,7 @@ int yyFlexLexer::yyinput() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + yy_c_buf_p = yytext_ptr + offset; break; case EOB_ACT_LAST_MATCH: @@ -1025,7 +1024,16 @@ int yyFlexLexer::yyinput() } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + + /* If we're doing %array, then we don't need to bother preserving + * yytext. Ironically, not doing so is a win in later preserving + * yytext if we're doing yymore(), because we won't have this + * errant '\0' sitting in the middle of it. + */ +#ifdef yytext_ptr *yy_c_buf_p = '\0'; /* preserve yytext */ +#endif + yy_hold_char = *++yy_c_buf_p; %% update BOL and yylineno