[comp.sources.bugs] patch for flex bug concerning backup and EOF

vern%lbl-pistachio@LBL-RTSG.ARPA (Vern Paxson) (05/27/88)

Esmond Pitt wrote earlier about a flex bug concerning getting "NULL in input"
messages at the end of files with certain rule sets.  The following
patch fixes the problem.

		Vern

*** old/fastskeldef.h	Sun May 22 22:01:52 1988
--- fastskeldef.h	Sun May 22 22:25:11 1988
***************
*** 74,80 ****
  	    while ( (yy_state_info = n[yy_current_state][yy_eq(*yy_c_buf_p)] ) != YY_JAM ) \
  		{ \
  		yy_current_state = yy_state_info; \
! 		YY_BACKTRACKING_ACTION \
  		yy_c_buf_p++; \
  		} \
  	    }
--- 74,80 ----
  	    while ( (yy_state_info = n[yy_current_state][yy_eq(*yy_c_buf_p)] ) != YY_JAM ) \
  		{ \
  		yy_current_state = yy_state_info; \
! 		YY_BACKTRACKING_ACTION(yy_current_state,yy_c_buf_p) \
  		yy_c_buf_p++; \
  		} \
  	    }
***************
*** 85,91 ****
  		  yy_c = yy_eq(*++yy_c_buf_p) ) \
  		{ \
  		yy_current_state += yy_trans_info->n; \
! 		YY_BACKTRACKING_ACTION \
  		}
  #endif
  
--- 85,91 ----
  		  yy_c = yy_eq(*++yy_c_buf_p) ) \
  		{ \
  		yy_current_state += yy_trans_info->n; \
! 		YY_BACKTRACKING_ACTION(yy_current_state,yy_c_buf_p) \
  		}
  #endif
  
***************
*** 97,105 ****
  
  
  #ifdef FLEX_FULL_TABLE
! #    define YY_GET_NEXT_STATE yy_cur_state = n[yy_cur_state][*(yy_temp_char_ptr++)]
  #else
! #    define YY_GET_NEXT_STATE yy_cur_state += yy_cur_state[*(yy_temp_char_ptr++)].n
  #endif
  
  #define EOB_ACT_RESTART_SCAN 2
--- 97,115 ----
  
  
  #ifdef FLEX_FULL_TABLE
! #    define YY_GET_NEXT_STATE \
! 	{ \
! 	yy_cur_state = n[yy_cur_state][yy_eq(*yy_temp_char_ptr)]; \
! 	YY_BACKTRACKING_ACTION(yy_cur_state,yy_temp_char_ptr) \
! 	++yy_temp_char_ptr; \
! 	}
  #else
! #    define YY_GET_NEXT_STATE \
! 	{ \
! 	yy_cur_state += yy_cur_state[yy_eq(*yy_temp_char_ptr)].n; \
! 	YY_BACKTRACKING_ACTION(yy_cur_state,yy_temp_char_ptr) \
! 	++yy_temp_char_ptr; \
! 	}
  #endif
  
  #define EOB_ACT_RESTART_SCAN 2
*** old/flex.fastskel	Tue May 10 20:09:04 1988
--- flex.fastskel	Sun May 22 22:25:28 1988
***************
*** 64,85 ****
  
  #ifdef FLEX_USES_BACKTRACKING
  #    ifdef FLEX_FULL_TABLE
! #	define YY_BACKTRACKING_ACTION \
! 		if ( l[yy_current_state] ) \
  			{ \
! 			yy_last_accepting_state = yy_current_state; \
! 			yy_last_accepting_cpos = yy_c_buf_p; \
  			}
  #    else
! #	define YY_BACKTRACKING_ACTION \
! 		if ( yy_current_state[-1].n ) \
  			{ \
! 			yy_last_accepting_state = yy_current_state; \
! 			yy_last_accepting_cpos = yy_c_buf_p; \
  			}
  #    endif
  #else
! #    define YY_BACKTRACKING_ACTION
  #endif
  
  YY_DECL
--- 64,85 ----
  
  #ifdef FLEX_USES_BACKTRACKING
  #    ifdef FLEX_FULL_TABLE
! #	define YY_BACKTRACKING_ACTION(cur_state,cur_buf_p) \
! 		if ( l[cur_state] ) \
  			{ \
! 			yy_last_accepting_state = cur_state; \
! 			yy_last_accepting_cpos = cur_buf_p; \
  			}
  #    else
! #	define YY_BACKTRACKING_ACTION(cur_state,cur_buf_p) \
! 		if ( cur_state[-1].n ) \
  			{ \
! 			yy_last_accepting_state = cur_state; \
! 			yy_last_accepting_cpos = cur_buf_p; \
  			}
  #    endif
  #else
! #    define YY_BACKTRACKING_ACTION(cur_state,cur_buf_p)
  #endif
  
  YY_DECL