diff options
-rw-r--r-- | src/cpp-flex.skl | 27 | ||||
-rw-r--r-- | src/flexdef.h | 3 | ||||
-rw-r--r-- | src/gen.c | 70 |
3 files changed, 27 insertions, 73 deletions
diff --git a/src/cpp-flex.skl b/src/cpp-flex.skl index 25b7612..83339ac 100644 --- a/src/cpp-flex.skl +++ b/src/cpp-flex.skl @@ -1997,6 +1997,33 @@ M4_GEN_START_STATE for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp ) { %% [16.0] code to find the next state goes here + /* Generate the code to find the next state. */ + m4_ifdef([[M4_MODE_NO_NULTRANS]], [[m4_define([[CHAR_MAP_3]], [[(*yy_cp ? M4_EC(YY_SC_TO_UI(*yy_cp)) : YY_NUL_EC)]])]]) + m4_ifdef([[M4_MODE_NULTRANS]], [[m4_define([[CHAR_MAP_3]], [[M4_EC(YY_SC_TO_UI(*yy_cp))]])]]) + + m4_ifdef([[M4_MODE_NULTRANS]], [[ + /* Compressed tables back up *before* they match. */ + m4_ifdef([[M4_MODE_NO_FULLSPD_OR_FULLTBL]], [[M4_GEN_BACKING_UP]]) + if ( *yy_cp ) { + ]]) + + m4_ifdef([[M4_MODE_FULLTBL]], [[ + m4_ifdef([[M4_MODE_GENTABLES]], [[yy_current_state = yy_nxt[yy_current_state][CHAR_MAP_3];]]) + m4_ifdef([[M4_MODE_NO_GENTABLES]], [[yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + CHAR_MAP_3];]]) + ]]) + + m4_ifdef([[M4_MODE_FULLSPD]], [[yy_current_state += yy_current_state[CHAR_MAP_3].yy_nxt;]]) + m4_ifdef([[M4_MODE_NO_FULLSPD_OR_FULLTBL]], [[M4_GEN_NEXT_COMPRESSED_STATE(CHAR_MAP_3)]]) + + m4_ifdef([[M4_MODE_NULTRANS]], [[ + } else { + yy_current_state = yy_NUL_trans[yy_current_state]; + } + ]]) + + m4_ifdef([[M4_MODE_FULLTBL]], [[M4_GEN_BACKING_UP]]) + m4_ifdef([[M4_MODE_FULLSPD]], [[M4_GEN_BACKING_UP]]) + m4_ifdef([[M4_MODE_USES_REJECT]], [[*YY_G(yy_state_ptr)++ = yy_current_state;]]) } return yy_current_state; diff --git a/src/flexdef.h b/src/flexdef.h index 7ee87eb..c68cbb8 100644 --- a/src/flexdef.h +++ b/src/flexdef.h @@ -786,9 +786,6 @@ extern void genftbl(void); /* generate full transition table */ /* Generate the code to find the next compressed-table state. */ extern void gen_next_compressed_state(char *); -/* Generate the code to find the next state. */ -extern void gen_next_state(int); - /* Generate the code to make a NUL transition. */ extern void gen_NUL_trans(void); @@ -513,72 +513,6 @@ void gen_next_compressed_state (char *char_map) } -/* Generate the code to find the next state. */ - -void gen_next_state (int worry_about_NULs) -{ /* NOTE - changes in here should be reflected in gen_next_match() */ - char *char_map; - - if (worry_about_NULs && !nultrans) { - if (useecs) - char_map = "(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : YY_NUL_EC)"; - else - char_map = "(*yy_cp ? YY_SC_TO_UI(*yy_cp) : YY_NUL_EC)"; - } - - else - char_map = useecs ? - "yy_ec[YY_SC_TO_UI(*yy_cp)] " : - "YY_SC_TO_UI(*yy_cp)"; - - if (worry_about_NULs && nultrans) { - if (!fulltbl && !fullspd) - /* Compressed tables back up *before* they match. */ - outn ("M4_GEN_BACKING_UP"); - - indent_puts ("if ( *yy_cp )"); - ++indent_level; - indent_puts ("{"); - } - - if (fulltbl) { - if (gentables) - indent_put2s - ("yy_current_state = yy_nxt[yy_current_state][%s];", - char_map); - else - indent_put2s - ("yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + %s];", - char_map); - } - - else if (fullspd) - indent_put2s - ("yy_current_state += yy_current_state[%s].yy_nxt;", - char_map); - - else - gen_next_compressed_state (char_map); - - if (worry_about_NULs && nultrans) { - - indent_puts ("}"); - --indent_level; - indent_puts ("else"); - ++indent_level; - indent_puts - ("yy_current_state = yy_NUL_trans[yy_current_state];"); - --indent_level; - } - - if (fullspd || fulltbl) - outn ("M4_GEN_BACKING_UP"); - - if (reject) - indent_puts ("*YY_G(yy_state_ptr)++ = yy_current_state;"); -} - - /* Generate the code to make a NUL transition. */ void gen_NUL_trans (void) @@ -1624,12 +1558,8 @@ void make_tables (void) /* Generate code for yy_get_previous_state(). */ - set_indent (1); skelout (); /* %% [15.0] - break point in skel */ - - set_indent (2); skelout (); /* %% [16.0] - break point in skel */ - gen_next_state (true); set_indent (1); skelout (); /* %% [17.0] - break point in skel */ |