From d08e3f47b31b91da2ebe24adf9aa5396e873aeb1 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Mon, 18 Dec 1995 14:20:41 +0000 Subject: [PATCH] don't stack states on NUL-transitions that are jams --- gen.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gen.c b/gen.c index 9051bf1..d0f7d7c 100644 --- a/gen.c +++ b/gen.c @@ -713,12 +713,20 @@ void gen_NUL_trans() (void) sprintf( NUL_ec_str, "%d", NUL_ec ); gen_next_compressed_state( NUL_ec_str ); - if ( reject ) - indent_puts( "*yy_state_ptr++ = yy_current_state;" ); - do_indent(); - out_dec( "yy_is_jam = (yy_current_state == %d);\n", jamstate ); + + if ( reject ) + { + /* Only stack this state if it's a transition we + * actually make. If we stack it on a jam, then + * the state stack and yy_c_buf_p get out of sync. + */ + indent_puts( "if ( ! yy_is_jam )" ); + indent_up(); + indent_puts( "*yy_state_ptr++ = yy_current_state;" ); + indent_down(); + } } /* If we've entered an accepting state, back up; note that -- 2.49.0