* src/getargs.h, src/getargs.c: Swap --report and --trace handling

to be in alphabetical order.
(trace_args): Spelling fixes.
This commit is contained in:
Akim Demaille
2006-07-09 15:38:42 +00:00
parent cd9e1ba28d
commit b8a4155924
3 changed files with 78 additions and 70 deletions

View File

@@ -1,3 +1,9 @@
2006-07-09 Akim Demaille <akim@lrde.epita.fr>
* src/getargs.h, src/getargs.c: Swap --report and --trace handling
to be in alphabetical order.
(trace_args): Spelling fixes.
2006-07-09 Paul Eggert <eggert@cs.ucla.edu>
* data/yacc.c (YYID, yy_stack_print): Prefix local vars with "yy"

View File

@@ -69,6 +69,54 @@ const char *include = NULL;
extern char *program_name;
/*----------------------.
| --report's handling. |
`----------------------*/
static const char * const report_args[] =
{
/* In a series of synonyms, present the most meaningful first, so
that argmatch_valid be more readable. */
"none",
"state", "states",
"itemset", "itemsets",
"lookahead", "lookaheads", "look-ahead",
"solved",
"all",
0
};
static const int report_types[] =
{
report_none,
report_states, report_states,
report_states | report_itemsets, report_states | report_itemsets,
report_states | report_lookahead_tokens,
report_states | report_lookahead_tokens,
report_states | report_lookahead_tokens,
report_states | report_solved_conflicts,
report_all
};
ARGMATCH_VERIFY (report_args, report_types);
static void
report_argmatch (char *args)
{
args = strtok (args, ",");
do
{
int report = XARGMATCH ("--report", args,
report_args, report_types);
if (report == report_none)
report_flag = report_none;
else
report_flag |= report;
}
while ((args = strtok (NULL, ",")));
}
/*---------------------.
| --trace's handling. |
`---------------------*/
@@ -77,12 +125,12 @@ static const char * const trace_args[] =
{
/* In a series of synonyms, present the most meaningful first, so
that argmatch_valid be more readable. */
"none - no report",
"none - no traces",
"scan - grammar scanner traces",
"parse - grammar parser traces",
"automaton - contruction of the automaton",
"automaton - construction of the automaton",
"bitsets - use of bitsets",
"grammar - reading, reducing of the grammar",
"grammar - reading, reducing the grammar",
"resource - memory consumption (where available)",
"sets - grammar sets: firsts, nullable etc.",
"tools - m4 invocation",
@@ -134,54 +182,6 @@ trace_argmatch (char *args)
}
/*----------------------.
| --report's handling. |
`----------------------*/
static const char * const report_args[] =
{
/* In a series of synonyms, present the most meaningful first, so
that argmatch_valid be more readable. */
"none",
"state", "states",
"itemset", "itemsets",
"lookahead", "lookaheads", "look-ahead",
"solved",
"all",
0
};
static const int report_types[] =
{
report_none,
report_states, report_states,
report_states | report_itemsets, report_states | report_itemsets,
report_states | report_lookahead_tokens,
report_states | report_lookahead_tokens,
report_states | report_lookahead_tokens,
report_states | report_solved_conflicts,
report_all
};
ARGMATCH_VERIFY (report_args, report_types);
static void
report_argmatch (char *args)
{
args = strtok (args, ",");
do
{
int report = XARGMATCH ("--report", args,
report_args, report_types);
if (report == report_none)
report_flag = report_none;
else
report_flag |= report;
}
while ((args = strtok (NULL, ",")));
}
/*-------------------------------------------.
| Display the help message and exit STATUS. |
`-------------------------------------------*/

View File

@@ -59,25 +59,6 @@ extern bool pure_parser;
extern bool nondeterministic_parser;
/* --trace. */
enum trace
{
trace_none = 0,
trace_scan = 1 << 0,
trace_parse = 1 << 1,
trace_resource = 1 << 2,
trace_sets = 1 << 3,
trace_bitsets = 1 << 4,
trace_tools = 1 << 5,
trace_automaton = 1 << 6,
trace_grammar = 1 << 7,
trace_time = 1 << 8,
trace_skeleton = 1 << 9,
trace_m4 = 1 << 10,
trace_all = ~0
};
extern int trace_flag;
/* --report. */
enum report
{
@@ -88,8 +69,29 @@ enum report
report_solved_conflicts = 1 << 3,
report_all = ~0
};
/** What appears in the *.output file. */
extern int report_flag;
/* --trace. */
enum trace
{
trace_none = 0, /**< No traces. */
trace_scan = 1 << 0, /**< Grammar scanner traces. */
trace_parse = 1 << 1, /**< Grammar parser traces. */
trace_resource = 1 << 2, /**< Memory allocation. */
trace_sets = 1 << 3, /**< Grammar sets: firsts, nullable etc. */
trace_bitsets = 1 << 4, /**< Use of bitsets. */
trace_tools = 1 << 5, /**< m4 invocation. */
trace_automaton = 1 << 6, /**< Construction of the automaton. */
trace_grammar = 1 << 7, /**< Reading, reducing the grammar. */
trace_time = 1 << 8, /**< Time consumption. */
trace_skeleton = 1 << 9, /**< Skeleton postprocessing. */
trace_m4 = 1 << 10, /**< M4 traces. */
trace_all = ~0 /**< All of the above. */
};
/** What debug items bison displays during its run. */
extern int trace_flag;
void getargs (int argc, char *argv[]);
#endif /* !GETARGS_H_ */