X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/e186a284863938a406f562630a3bdc48737a664a..812775a0391e122eff1983afea2da96c600c7307:/src/getargs.c diff --git a/src/getargs.c b/src/getargs.c index a8d1c548..962dad4d 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -1,7 +1,7 @@ /* Parse command line arguments for Bison. Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -176,10 +176,12 @@ static const char * const trace_args[] = "grammar - reading, reducing the grammar", "resource - memory consumption (where available)", "sets - grammar sets: firsts, nullable etc.", + "muscles - m4 definitions passed to the skeleton", "tools - m4 invocation", "m4 - m4 traces", "skeleton - skeleton postprocessing", "time - time consumption", + "ielr - IELR conversion", "all - all of the above", 0 }; @@ -194,10 +196,12 @@ static const int trace_types[] = trace_grammar, trace_resource, trace_sets, + trace_muscles, trace_tools, trace_m4, trace_skeleton, trace_time, + trace_ielr, trace_all }; @@ -214,7 +218,7 @@ static const char * const warnings_args[] = that argmatch_valid be more readable. */ "none - no warnings", "midrule-values - unset or unused midrule values", - "yacc - incompatibilities with POSIX YACC", + "yacc - incompatibilities with POSIX Yacc", "all - all of the above", "error - warnings are errors", 0 @@ -246,9 +250,15 @@ usage (int status) program_name); else { + /* For ../build-aux/cross-options.pl to work, use the format: + ^ -S, --long[=ARGS] (whitespace) + A --long option is required. + Otherwise, add exceptions to ../build-aux/cross-options.pl. */ + printf (_("Usage: %s [OPTION]... FILE\n"), program_name); fputs (_("\ -Generate LALR(1) and GLR parsers.\n\ +Generate a deterministic or GLR parser employing LALR(1), IELR(1), or\n\ +canonical LR(1) parser tables.\n\ \n\ "), stdout); @@ -305,7 +315,7 @@ Output:\n\ fputs (_("\ Warning categories include:\n\ `midrule-values' unset or unused midrule values\n\ - `yacc' incompatibilities with POSIX YACC\n\ + `yacc' incompatibilities with POSIX Yacc\n\ `all' all the warnings\n\ `no-CATEGORY' turn off warnings in CATEGORY\n\ `none' turn off all the warnings\n\ @@ -497,7 +507,7 @@ static struct option const long_options[] = /* Build a location for the current command line argument. */ static location -command_line_location() +command_line_location (void) { location res; /* "" is used in GCC's messages about -D. */ @@ -529,9 +539,8 @@ getargs (int argc, char *argv[]) char* value = strchr (optarg, '='); if (value) *value++ = 0; - else - value = ""; - muscle_percent_define_insert (name, command_line_location (), value); + muscle_percent_define_insert (name, command_line_location (), + value ? value : ""); } break; @@ -654,3 +663,11 @@ getargs (int argc, char *argv[]) current_file = grammar_file = uniqstr_new (argv[optind]); MUSCLE_INSERT_C_STRING ("file_name", grammar_file); } + +void +tr (char *s, char from, char to) +{ + for (; *s; s++) + if (*s == from) + *s = to; +}