31 |
int locations_flag = 0; |
int locations_flag = 0; |
32 |
int no_lines_flag = 0; |
int no_lines_flag = 0; |
33 |
int no_parser_flag = 0; |
int no_parser_flag = 0; |
34 |
int report_flag = 0; |
int report_flag = report_none; |
35 |
int token_table_flag = 0; |
int token_table_flag = 0; |
36 |
int yacc_flag = 0; /* for -y */ |
int yacc_flag = 0; /* for -y */ |
37 |
int graph_flag = 0; |
int graph_flag = 0; |
38 |
int trace_flag = 0; |
int trace_flag = trace_none; |
39 |
|
|
40 |
const char *skeleton = NULL; |
const char *skeleton = NULL; |
41 |
const char *include = NULL; |
const char *include = NULL; |
42 |
|
|
43 |
extern char *program_name; |
extern char *program_name; |
44 |
|
|
45 |
|
|
46 |
|
/*---------------------. |
47 |
|
| --trace's handling. | |
48 |
|
`---------------------*/ |
49 |
|
|
50 |
|
static const char * const trace_args[] = |
51 |
|
{ |
52 |
|
/* In a series of synonyms, present the most meaningful first, so |
53 |
|
that argmatch_valid be more readable. */ |
54 |
|
"none - no report", |
55 |
|
"automaton - contruction of the automaton", |
56 |
|
"bitsets - use of bitsets", |
57 |
|
"grammar - reading, reducing of the grammar", |
58 |
|
"resource - time and memory (where available)", |
59 |
|
"sets - grammar sets: firsts, nullable etc.", |
60 |
|
"tools - m4 invocation and preserve the temporary file", |
61 |
|
"all - all of the above", |
62 |
|
0 |
63 |
|
}; |
64 |
|
|
65 |
|
static const int trace_types[] = |
66 |
|
{ |
67 |
|
trace_none, |
68 |
|
trace_automaton, |
69 |
|
trace_bitsets, |
70 |
|
trace_grammar, |
71 |
|
trace_resource, |
72 |
|
trace_sets, |
73 |
|
trace_tools, |
74 |
|
trace_all |
75 |
|
}; |
76 |
|
|
77 |
|
|
78 |
|
static void |
79 |
|
trace_argmatch (char *args) |
80 |
|
{ |
81 |
|
ARGMATCH_ASSERT (trace_args, trace_types); |
82 |
|
if (args) |
83 |
|
{ |
84 |
|
args = strtok (args, ","); |
85 |
|
do |
86 |
|
{ |
87 |
|
int trace = XARGMATCH ("--trace", args, |
88 |
|
trace_args, trace_types); |
89 |
|
if (trace == trace_none) |
90 |
|
trace_flag = trace_none; |
91 |
|
else |
92 |
|
trace_flag |= trace; |
93 |
|
} |
94 |
|
while ((args = strtok (NULL, ","))); |
95 |
|
} |
96 |
|
else |
97 |
|
trace_flag = trace_all; |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
/*----------------------. |
/*----------------------. |
102 |
| --report's handling. | |
| --report's handling. | |
103 |
`----------------------*/ |
`----------------------*/ |
242 |
`----------------------*/ |
`----------------------*/ |
243 |
|
|
244 |
/* Shorts options. */ |
/* Shorts options. */ |
245 |
const char *short_options = "yvegdhr:ltknVo:b:p:S:"; |
const char *short_options = "yvegdhr:ltknVo:b:p:S:T::"; |
246 |
|
|
247 |
static struct option const long_options[] = |
static struct option const long_options[] = |
248 |
{ |
{ |
263 |
{ "verbose", no_argument, 0, 'v' }, |
{ "verbose", no_argument, 0, 'v' }, |
264 |
|
|
265 |
/* Hidden. */ |
/* Hidden. */ |
266 |
{ "trace", no_argument, &trace_flag, 1 }, |
{ "trace", optional_argument, 0, 'T' }, |
267 |
|
|
268 |
/* FIXME: semantic parsers will output an `include' of an |
/* FIXME: semantic parsers will output an `include' of an |
269 |
output file: be sure that the naem included is indeed the name of |
output file: be sure that the naem included is indeed the name of |
385 |
report_argmatch (optarg); |
report_argmatch (optarg); |
386 |
break; |
break; |
387 |
|
|
388 |
|
case 'T': |
389 |
|
trace_argmatch (optarg); |
390 |
|
break; |
391 |
|
|
392 |
default: |
default: |
393 |
fprintf (stderr, _("Try `%s --help' for more information.\n"), |
fprintf (stderr, _("Try `%s --help' for more information.\n"), |
394 |
program_name); |
program_name); |