summaryrefslogtreecommitdiff
path: root/gen.c
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1995-12-18 14:20:41 +0000
committerVern Paxson <vern@ee.lbl.gov>1995-12-18 14:20:41 +0000
commitd08e3f47b31b91da2ebe24adf9aa5396e873aeb1 (patch)
treef87569522d5bd13b9d18b1292d8d5dce42a9f330 /gen.c
parent55ad94bb49542a0a15b20c8ec16f8156cd602c01 (diff)
don't stack states on NUL-transitions that are jams
Diffstat (limited to 'gen.c')
-rw-r--r--gen.c16
1 files 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