X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/0d8f3c8a7ab5a379c80caa26b64152c5a873942d..8c7d6a3de82ca7fcbdfa6ad31c3bf70f63c6a069:/src/lex.c diff --git a/src/lex.c b/src/lex.c index 4eefa737..4bd0a6f2 100644 --- a/src/lex.c +++ b/src/lex.c @@ -1,5 +1,5 @@ /* Token-reader for Bison's input parser, - Copyright 1984, 1986, 1989, 1992, 2000 Free Software Foundation, Inc. + Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -31,7 +31,7 @@ /* Buffer for storing the current token. */ struct obstack token_obstack; -char *token_buffer = NULL; +const char *token_buffer = NULL; bucket *symval; int numval; @@ -234,10 +234,10 @@ literalchar (struct obstack *out, int *pcode, char term) } else { - char buf [] = "c"; - buf[0] = c; + char badchar [] = "c"; + badchar[0] = c; complain (_("unknown escape sequence: `\\' followed by `%s'"), - quote (buf)); + quote (badchar)); code = '?'; } } /* has \ */ @@ -537,7 +537,7 @@ struct percent_table_struct percent_table[] = { "prec", NULL, tok_prec }, { "locations", &locations_flag, tok_noop }, /* -l */ { "no_lines", &no_lines_flag, tok_noop }, /* -l */ - { "raw", &raw_flag, tok_noop }, /* -r */ + { "raw", NULL, tok_obsolete }, /* -r */ { "token_table", &token_table_flag, tok_noop }, /* -k */ { "yacc", &yacc_flag, tok_noop }, /* -y */ { "fixed_output_files",&yacc_flag, tok_noop }, /* -y */ @@ -552,6 +552,8 @@ struct percent_table_struct percent_table[] = { "file_prefix", &spec_file_prefix, tok_setopt }, /* -b */ { "name_prefix", &spec_name_prefix, tok_setopt }, /* -p */ #endif + { "header_extension", NULL, tok_hdrext}, + { "source_extension", NULL, tok_srcext}, { "verbose", &verbose_flag, tok_noop }, /* -v */ { "debug", &debug_flag, tok_noop }, /* -t */ { "semantic_parser", &semantic_parser, tok_noop }, @@ -616,15 +618,23 @@ parse_percent_token (void) if (strcmp (token_buffer + 1, tx->name) == 0) break; - if (tx->retval == tok_setopt) + if (tx->set_flag) { - *((char **) (tx->set_flag)) = optarg; + *((int *) (tx->set_flag)) = 1; return tok_noop; } - if (tx->set_flag) + + switch (tx->retval) { - *((int *) (tx->set_flag)) = 1; + case tok_setopt: + *((char **) (tx->set_flag)) = optarg; return tok_noop; + break; + + case tok_obsolete: + fatal (_("`%s' is no longer supported"), token_buffer); + break; } + return tx->retval; }