=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/lex/flex.skl,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** src/usr.bin/lex/flex.skl 1996/07/13 22:21:58 1.3 --- src/usr.bin/lex/flex.skl 1996/12/10 22:22:00 1.4 *************** *** 1,9 **** ! /* $OpenBSD: flex.skl,v 1.3 1996/07/13 22:21:58 millert Exp $ */ /* A lexical scanner generated by flex */ /* Scanner skeleton version: ! * $Header: /cvsrepo/anoncvs/cvs/src/usr.bin/lex/flex.skl,v 1.3 1996/07/13 22:21:58 millert Exp $ */ #define FLEX_SCANNER --- 1,9 ---- ! /* $OpenBSD: flex.skl,v 1.4 1996/12/10 22:22:00 millert Exp $ */ /* A lexical scanner generated by flex */ /* Scanner skeleton version: ! * $Header: /cvsrepo/anoncvs/cvs/src/usr.bin/lex/flex.skl,v 1.4 1996/12/10 22:22:00 millert Exp $ */ #define FLEX_SCANNER *************** *** 252,258 **** #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); ! YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); %* --- 252,258 ---- #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); ! YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); %* *************** *** 785,791 **** /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ ! yy_n_chars = 0; else { --- 785,791 ---- /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ ! yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { *************** *** 840,845 **** --- 840,847 ---- /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) *************** *** 949,955 **** yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); ! yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); --- 951,958 ---- yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); ! yy_current_buffer->yy_n_chars = ! yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); *************** *** 999,1011 **** switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { if ( yywrap() ) - { - yy_c_buf_p = yytext_ptr + offset; return EOF; - } if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; --- 1002,1027 ---- switch ( yy_get_next_buffer() ) { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; *************** *** 1019,1033 **** case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; - - case EOB_ACT_LAST_MATCH: - #ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); - #else - YY_FATAL_ERROR( - "unexpected last match in input()" ); - #endif } } } --- 1035,1040 ---- *************** *** 1225,1230 **** --- 1232,1240 ---- void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) %* { + if ( ! b ) + return; + b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes *************** *** 1288,1304 **** #ifndef YY_NO_SCAN_STRING %- #ifdef YY_USE_PROTOS ! YY_BUFFER_STATE yy_scan_string( yyconst char *str ) #else ! YY_BUFFER_STATE yy_scan_string( str ) ! yyconst char *str; #endif { int len; ! for ( len = 0; str[len]; ++len ) ; ! return yy_scan_bytes( str, len ); } %* #endif --- 1298,1314 ---- #ifndef YY_NO_SCAN_STRING %- #ifdef YY_USE_PROTOS ! YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else ! YY_BUFFER_STATE yy_scan_string( yy_str ) ! yyconst char *yy_str; #endif { int len; ! for ( len = 0; yy_str[len]; ++len ) ; ! return yy_scan_bytes( yy_str, len ); } %* #endif