mirror of
https://github.com/westes/flex.git
synced 2026-01-26 15:39:06 +00:00
Tweak the indent style of tables with macroexpanded bodies...
...to have an indent style uniform with the rest of the code, and one that makes it easier noy to miss the trailing table delimiters. Not all tables are generated this way yet. I'm working on it. Is isolated in its own commit so the format change can't confuse a reviewer's eyeballs out of noticing real mutations in the table data. #65 in the retargeting patch series
This commit is contained in:
parent
96e004a296
commit
716cb63ff2
@ -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;
|
||||
]])
|
||||
|
||||
]])
|
||||
|
||||
]])
|
||||
|
||||
@ -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",
|
||||
|
||||
17
src/misc.c
17
src/misc.c
@ -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 (',');
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user