diff options
author | Vern Paxson <vern@ee.lbl.gov> | 1994-12-15 14:30:07 +0000 |
---|---|---|
committer | Vern Paxson <vern@ee.lbl.gov> | 1994-12-15 14:30:07 +0000 |
commit | 295068c97b29f797c5dbbc8843f337c07b7216f8 (patch) | |
tree | 6b5bc3c63858d2a80db1af0c3833fd1b48b6d9f3 /gen.c | |
parent | dc23afbcf58a73cd8f1588d437b8c9b0d9ba6a89 (diff) |
fixed bug in adjusting yytext before backing up
Diffstat (limited to 'gen.c')
-rw-r--r-- | gen.c | 44 |
1 files changed, 31 insertions, 13 deletions
@@ -352,17 +352,17 @@ void gen_find_action() } else - { - /* Remember matched text in case we back up due to trailing - * context plus REJECT. - */ - indent_up(); - indent_puts( "{" ); - indent_puts( "yy_full_match = yy_cp;" ); - indent_puts( "break;" ); - indent_puts( "}" ); - indent_down(); - } + { + /* Remember matched text in case we back up due to + * trailing context plus REJECT. + */ + indent_up(); + indent_puts( "{" ); + indent_puts( "yy_full_match = yy_cp;" ); + indent_puts( "break;" ); + indent_puts( "}" ); + indent_down(); + } indent_puts( "}" ); indent_down(); @@ -382,8 +382,26 @@ void gen_find_action() } else - /* compressed */ + { /* compressed */ indent_puts( "yy_act = yy_accept[yy_current_state];" ); + + if ( interactive && ! reject ) + { + /* Do the guaranteed-needed backing up to figure out + * the match. + */ + indent_puts( "if ( yy_act == 0 )" ); + indent_up(); + indent_puts( "{ /* have to back up */" ); + + indent_puts( "yy_cp = yy_last_accepting_cpos;" ); + indent_puts( + "yy_current_state = yy_last_accepting_state;" ); + indent_puts( "yy_act = yy_accept[yy_current_state];" ); + indent_puts( "}" ); + indent_down(); + } + } } @@ -1454,7 +1472,7 @@ void make_tables() * finds that it should JAM on the NUL. */ skelout(); - set_indent( 7 ); + set_indent( 4 ); if ( fullspd || fulltbl ) indent_puts( "yy_cp = yy_c_buf_p;" ); |