- {"debug", 0, &debugflag, 1},
- {"defines", 0, &definesflag, 1},
- {"file-prefix", 1, 0, 'b'},
- {"fixed-output-files", 0, &yaccflag, 1},
- {"help", 0, 0, 'h'},
- {"name-prefix", 1, 0, 'p'}, /* was 'a'; apparently unused -wjh */
- {"no-lines", 0, &nolinesflag, 1},
- {"no-parser", 0, &noparserflag, 1},
- {"output", 1, 0, 'o'},
- {"output-file", 1, 0, 'o'},
- {"raw", 0, &rawtoknumflag, 1},
- {"token-table", 0, &toknumflag, 1},
- {"verbose", 0, &verboseflag, 1},
- {"version", 0, 0, 'V'},
- {"yacc", 0, &yaccflag, 1},
- {"statistics", 0, &statisticsflag, 1},
- {0, 0, 0, 0}
+ if (args)
+ {
+ args = strtok (args, ",");
+ do
+ {
+ int value = XARGMATCH (option, args, keys, values);
+ if (value == 0)
+ *flags = 0;
+ else
+ *flags |= value;
+ }
+ while ((args = strtok (NULL, ",")));
+ }
+ else
+ *flags = ~0;
+}
+
+/** Decode a set of sub arguments.
+ *
+ * \param FlagName the flag familly to update.
+ * \param args the effective sub arguments to decode.
+ *
+ * \arg FlagName_args the list of keys.
+ * \arg FlagName_types the list of values.
+ * \arg FlagName_flag the flag to update.
+ */
+#define FLAGS_ARGMATCH(FlagName, Args) \
+ flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \
+ &FlagName ## _flag, 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);
+
+
+/*---------------------.
+| --trace's handling. |
+`---------------------*/
+
+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 traces",
+ "scan - grammar scanner traces",
+ "parse - grammar parser traces",
+ "automaton - construction of the automaton",
+ "bitsets - use of bitsets",
+ "grammar - reading, reducing the grammar",
+ "resource - memory consumption (where available)",
+ "sets - grammar sets: firsts, nullable etc.",
+ "tools - m4 invocation",
+ "m4 - m4 traces",
+ "skeleton - skeleton postprocessing",
+ "time - time consumption",
+ "all - all of the above",
+ 0
+};
+
+static const int trace_types[] =
+{
+ trace_none,
+ trace_scan,
+ trace_parse,
+ trace_automaton,
+ trace_bitsets,
+ trace_grammar,
+ trace_resource,
+ trace_sets,
+ trace_tools,
+ trace_m4,
+ trace_skeleton,
+ trace_time,
+ trace_all
+};
+
+ARGMATCH_VERIFY (trace_args, trace_types);
+
+
+/*------------------------.
+| --warnings's handling. |
+`------------------------*/
+
+static const char * const warnings_args[] =
+{
+ /* In a series of synonyms, present the most meaningful first, so
+ that argmatch_valid be more readable. */
+ "none - no warnings",
+ "error - warnings are errors",
+ "yacc - incompatibilities with POSIX YACC",
+ "all - all of the above",
+ 0
+};
+
+static const int warnings_types[] =
+{
+ warnings_none,
+ warnings_error,
+ warnings_yacc,
+ warnings_all