diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cpp-flex.skl | 57 | ||||
-rw-r--r-- | src/cpp_backend.c | 6 | ||||
-rw-r--r-- | src/gen.c | 4 | ||||
-rw-r--r-- | src/misc.c | 17 |
4 files changed, 45 insertions, 39 deletions
diff --git a/src/cpp-flex.skl b/src/cpp-flex.skl index a66e67d..ccea2f5 100644 --- a/src/cpp-flex.skl +++ b/src/cpp-flex.skl @@ -71,11 +71,9 @@ m4_define([[M4_HOOK_COMMENT_CLOSE]], [[*/]]) m4_define([[M4_HOOK_TRACE_LINE_FORMAT]], [[#line $1 "$2" ]]) -m4_define([[M4_HOOK_TABLE_OPENER]], [[ {]]) -m4_define([[M4_HOOK_TABLE_CONTINUE]], [[ }, -]]) -m4_define([[M4_HOOK_TABLE_CLOSER]], [[ }; -]]) +m4_define([[M4_HOOK_TABLE_OPENER]], [[{]]) +m4_define([[M4_HOOK_TABLE_CONTINUE]], [[},]]) +m4_define([[M4_HOOK_TABLE_CLOSER]], [[};]]) m4_define([[M4_HOOK_STATE_ENTRY_FORMAT]], [[ &yy_transition[$1], ]]) @@ -874,77 +872,84 @@ int yy_flex_debug = m4_ifdef([[M4_MODE_DEBUG]],[[1]],[[0]]); m4_ifdef( [[M4_MODE_YYLINENO]],[[m4_dnl /* Table of booleans, true if rule could match eol. */ m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const M4_HOOK_EOLTABLE_TYPE yy_rule_can_match_eol[M4_HOOK_EOLTABLE_SIZE] = - { 0, -M4_HOOK_EOLTABLE_BODY[[]]}; +static const M4_HOOK_EOLTABLE_TYPE yy_rule_can_match_eol[M4_HOOK_EOLTABLE_SIZE] = { 0, +M4_HOOK_EOLTABLE_BODY[[]]m4_dnl +}; ]], [[ static const M4_HOOK_EOLTABLE_TYPE * yy_rule_can_match_eol = 0; ]]) + ]]) m4_ifdef( [[M4_MODE_REAL_FULLTBL]],[[m4_dnl m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const M4_HOOK_FULLTABLE_TYPE yy_accept[M4_HOOK_FULLTABLE_SIZE] = - { 0, -M4_HOOK_FULLTABLE_BODY[[]]}; +static const M4_HOOK_FULLTABLE_TYPE yy_accept[M4_HOOK_FULLTABLE_SIZE] = { 0, +M4_HOOK_FULLTABLE_BODY[[]]m4_dnl +}; ]], [[ static const M4_HOOK_FULLTABLE_TYPE * yy_accept = 0; ]]) + ]]) m4_ifdef( [[M4_MODE_USEECS]],[[m4_dnl /* Character equivalence-class mapping */ m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const YY_CHAR yy_ec[M4_HOOK_ECSTABLE_SIZE] = - { 0, -M4_HOOK_ECSTABLE_BODY[[]]}; +static const YY_CHAR yy_ec[M4_HOOK_ECSTABLE_SIZE] = { 0, +M4_HOOK_ECSTABLE_BODY[[]]m4_dnl +}; ]], [[ static const YY_CHAR * yy_ec = 0; ]]) + ]]) m4_ifdef( [[M4_MODE_DEBUG]],[[m4_dnl /* Rule to line-number mapping */ m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const M4_HOOK_DEBUGTABLE_TYPE yy_rule_linenum[M4_HOOK_DEBUGTABLE_SIZE] = - { 0, -M4_HOOK_DEBUGTABLE_BODY[[]]}; +static const M4_HOOK_DEBUGTABLE_TYPE yy_rule_linenum[M4_HOOK_DEBUGTABLE_SIZE] = { 0, +M4_HOOK_DEBUGTABLE_BODY[[]]m4_dnl +}; ]], [[ static const M4_HOOK_DEBUGTABLE_TYPE * yy_rule_linenum = 0; ]]) + ]]) m4_ifdef( [[M4_MODE_USEMECS]],[[m4_dnl /* Character meta-equivalence-class mappings */ m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const YY_CHAR yy_meta[M4_HOOK_MECSTABLE_SIZE] = - { 0, -M4_HOOK_MECSTABLE_BODY[[]]}; +static const YY_CHAR yy_meta[M4_HOOK_MECSTABLE_SIZE] = { 0, +M4_HOOK_MECSTABLE_BODY[[]]m4_dnl +}; ]], [[ static const YY_CHAR * yy_meta = 0; ]]) + ]]) m4_ifdef( [[M4_HOOK_TRANSTABLE_SIZE]],[[m4_dnl /* The transition table */ m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const struct yy_trans_info yy_transition[M4_HOOK_TRANSTABLE_SIZE] = - { -M4_HOOK_TRANSTABLE_BODY[[]]}; +static const struct yy_trans_info yy_transition[M4_HOOK_TRANSTABLE_SIZE] = { +M4_HOOK_TRANSTABLE_BODY[[]]m4_dnl +}; ]], [[ static const struct yy_trans_info *yy_transition = 0; ]]) + ]]) m4_ifdef( [[M4_HOOK_STARTTABLE_SIZE]],[[m4_dnl /* Table of pointers to start states. */ m4_ifdef( [[M4_MODE_GENTABLES]],[[m4_dnl -static const struct yy_trans_info *yy_start_state_list[M4_HOOK_STARTTABLE_SIZE] = - { -M4_HOOK_STARTTABLE_BODY[[]]}; +static const struct yy_trans_info *yy_start_state_list[M4_HOOK_STARTTABLE_SIZE] = { +M4_HOOK_STARTTABLE_BODY[[]]m4_dnl +}; ]], [[ static const struct yy_trans_info **yy_start_state_list =0; ]]) + ]]) ]]) diff --git a/src/cpp_backend.c b/src/cpp_backend.c index 6a02f1a..f56488a 100644 --- a/src/cpp_backend.c +++ b/src/cpp_backend.c @@ -47,7 +47,7 @@ struct yy_trans_info {int32_t yy_verify; int32_t yy_nxt;}; static const char *cpp_get_int16_decl (void) { return (gentables) - ? "static const flex_int16_t %s[%d] =\n { 0,\n" + ? "static const flex_int16_t %s[%d] = { 0,\n" : "static const flex_int16_t * %s = 0;\n"; } @@ -55,14 +55,14 @@ static const char *cpp_get_int16_decl (void) static const char *cpp_get_int32_decl (void) { return (gentables) - ? "static const flex_int32_t %s[%d] =\n { 0,\n" + ? "static const flex_int32_t %s[%d] = { 0,\n" : "static const flex_int32_t * %s = 0;\n"; } static const char *cpp_get_state_decl (void) { return (gentables) - ? "static const yy_state_type %s[%d] =\n { 0,\n" + ? "static const yy_state_type %s[%d] = { 0,\n" : "static const yy_state_type * %s = 0;\n"; } @@ -684,8 +684,8 @@ void gentabs (void) fputs (_("\n\nMeta-Equivalence Classes:\n"), stderr); out_dec ("m4_define([[M4_HOOK_MECSTABLE_SIZE]], [[%d]])", numecs+1); - outn ("m4_define([[M4_HOOK_MECSTABLE_BODY]], [["); - + outn ("m4_define([[M4_HOOK_MECSTABLE_BODY]], [[m4_dnl"); + for (i = 1; i <= numecs; ++i) { if (env.trace) fprintf (stderr, "%d = %d\n", @@ -217,13 +217,13 @@ char *xstrdup(const char *s) int cclcmp (const void *a, const void *b) { - if (!*(const unsigned char *) a) - return 1; - else - if (!*(const unsigned char *) b) - return - 1; + if (!*(const unsigned char *) a) + return 1; else - return *(const unsigned char *) a - *(const unsigned char *) b; + if (!*(const unsigned char *) b) + return - 1; + else + return *(const unsigned char *) a - *(const unsigned char *) b; } @@ -254,7 +254,8 @@ void dataflush (void) if (!gentables) return; - outc ('\n'); + if (datapos > 0) + outc ('\n'); if (++dataline >= NUMDATALINES) { /* Put out a blank line so that the table is grouped into @@ -432,7 +433,7 @@ void mkdata (int value) if (datapos == 0) /* Indent. */ - out (" "); + out (" "); else outc (','); |