From 62ab6972e8338613d09562166b4b4fa5f48693a4 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 18 Jul 2001 09:52:35 +0000 Subject: [PATCH] * src/getargs.h (raw_flag): Remove. * src/getargs.c: Die on `-r'/`--raw'. * src/lex.c (parse_percent_token): Die on `%raw'. * src/reader.c (output_token_defines): Suppress call to `raw_flag'. * tests/calc.at: Suppress test with option `--raw'. --- ChangeLog | 8 ++ NEWS | 2 + doc/bison.1 | 33 +++----- doc/bison.info | 197 +++++++++++++++++++++++----------------------- doc/bison.info-1 | 3 +- doc/bison.info-2 | 3 +- doc/bison.info-3 | 10 +-- doc/bison.info-4 | 13 +-- doc/bison.info-5 | 3 +- doc/bison.texinfo | 18 ----- doc/stamp-vti | 2 +- doc/version.texi | 2 +- src/getargs.c | 4 +- src/getargs.h | 1 - src/lex.c | 20 +++-- src/lex.h | 5 +- src/reader.c | 3 +- tests/calc.at | 2 - 18 files changed, 149 insertions(+), 180 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07d7a08b..4cbc516a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-07-05 Pascal Bart + + * src/getargs.h (raw_flag): Remove. + * src/getargs.c: Die on `-r'/`--raw'. + * src/lex.c (parse_percent_token): Die on `%raw'. + * src/reader.c (output_token_defines): Suppress call to `raw_flag'. + * tests/calc.at: Suppress test with option `--raw'. + 2001-07-14 Akim Demaille * config/: New. diff --git a/NEWS b/NEWS index 988894ec..2a9937d1 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ Changes in version 1.28a: * Added `-S' and `--skeleton'. +* `%raw', `-r', `--raw' is disabled. + * Special characters are escaped when output. This solves the problems of the #line lines with path names including backslashes. diff --git a/doc/bison.1 b/doc/bison.1 index 471952d9..0357819c 100644 --- a/doc/bison.1 +++ b/doc/bison.1 @@ -32,10 +32,6 @@ bison \- GNU Project parser generator (yacc replacement) ] [ .BI \-\-name-prefix= prefix ] [ -.B \-r -] [ -.B \-\-raw -] [ .B \-t ] [ .B \-\-debug @@ -140,31 +136,20 @@ in a separate source file, because needs to be able to refer to token type codes and the variable .BR yylval . .TP -.B \-r -.br -.ns -.TP -.B \-\-raw -The token numbers in the \fIname\fB.h\fR file are usually the Yacc compatible -translations. If this switch is specified, Bison token numbers -are output instead. (Yacc numbers start at 257 except for single character -tokens; Bison assigns token numbers sequentially for all tokens -starting at 3.) -.TP .B \-k .br .ns .TP .B \-\-token-table -This switch causes the \fIname\fB.tab.c\fR output to include a list of -token names in order by their token numbers; this is defined in the array +This switch causes the \fIname\fB.tab.c\fR output to include a list of +token names in order by their token numbers; this is defined in the array .IR yytname . -Also generated -are #defines for +Also generated +are #defines for .IR YYNTOKENS , .IR YYNNTS , .IR YYNRULES , -and +and .IR YYNSTATES . .TP .B \-l @@ -188,10 +173,10 @@ parser file, treating it an independent source file in its own right. .TP .B \-\-no-parser Do not generate the parser code into the output; generate only -declarations. The generated \fIname\fB.tab.c\fR file will have only +declarations. The generated \fIname\fB.tab.c\fR file will have only constant declarations. In addition, a \fIname\fB.act\fR file is generated containing a switch statement body containing all the -translated actions. +translated actions. .TP .BI \-o " outfile" .br @@ -224,7 +209,7 @@ The precise list of symbols renamed is .BR yylex , .BR yyerror , .BR yylval , -.BR yychar , +.BR yychar , and .BR yydebug . .sp @@ -241,7 +226,7 @@ and so on. .TP .B \-\-debug Output a definition of the macro -.B YYDEBUG +.B YYDEBUG into the parser file, so that the debugging facilities are compiled. .TP diff --git a/doc/bison.info b/doc/bison.info index 2cdadffa..f25cd648 100644 --- a/doc/bison.info +++ b/doc/bison.info @@ -1,4 +1,5 @@ -This is bison.info, produced by makeinfo version 4.0 from bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à +partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). @@ -29,105 +30,105 @@ instead of in the original English.  Indirect: -bison.info-1: 1285 -bison.info-2: 50255 -bison.info-3: 98216 -bison.info-4: 147733 -bison.info-5: 192266 +bison.info-1: 1306 +bison.info-2: 50276 +bison.info-3: 98237 +bison.info-4: 147410 +bison.info-5: 191643  Tag Table: (Indirect) -Node: Top1285 -Node: Introduction8521 -Node: Conditions9796 -Node: Copying11260 -Node: Concepts30452 -Node: Language and Grammar31485 -Node: Grammar in Bison36501 -Node: Semantic Values38425 -Node: Semantic Actions40526 -Node: Bison Parser41709 -Node: Stages44019 -Node: Grammar Layout45302 -Node: Examples46559 -Node: RPN Calc47694 -Node: Rpcalc Decls48668 -Node: Rpcalc Rules50255 -Node: Rpcalc Input52055 -Node: Rpcalc Line53516 -Node: Rpcalc Expr54631 -Node: Rpcalc Lexer56576 -Node: Rpcalc Main59148 -Node: Rpcalc Error59546 -Node: Rpcalc Gen60554 -Node: Rpcalc Compile61703 -Node: Infix Calc62578 -Node: Simple Error Recovery65285 -Node: Multi-function Calc67171 -Node: Mfcalc Decl68737 -Node: Mfcalc Rules70760 -Node: Mfcalc Symtab72140 -Node: Exercises78513 -Node: Grammar File79019 -Node: Grammar Outline79787 -Node: C Declarations80521 -Node: Bison Declarations81101 -Node: Grammar Rules81513 -Node: C Code81973 -Node: Symbols82903 -Node: Rules87984 -Node: Recursion89623 -Node: Semantics91342 -Node: Value Type92439 -Node: Multiple Types93111 -Node: Actions94128 -Node: Action Types96913 -Node: Mid-Rule Actions98216 -Node: Declarations103785 -Node: Token Decl105104 -Node: Precedence Decl107117 -Node: Union Decl108668 -Node: Type Decl109512 -Node: Expect Decl110418 -Node: Start Decl111964 -Node: Pure Decl112342 -Node: Decl Summary114019 -Node: Multiple Parsers119746 -Node: Interface121240 -Node: Parser Function122112 -Node: Lexical122947 -Node: Calling Convention124353 -Node: Token Values127124 -Node: Token Positions128273 -Node: Pure Calling129165 -Node: Error Reporting132097 -Node: Action Features134219 -Node: Algorithm137880 -Node: Look-Ahead140173 -Node: Shift/Reduce142305 -Node: Precedence145217 -Node: Why Precedence145868 -Node: Using Precedence147733 -Node: Precedence Examples148701 -Node: How Precedence149402 -Node: Contextual Precedence150551 -Node: Parser States152342 -Node: Reduce/Reduce153585 -Node: Mystery Conflicts157146 -Node: Stack Overflow160532 -Node: Error Recovery161905 -Node: Context Dependency167041 -Node: Semantic Tokens167889 -Node: Lexical Tie-ins170906 -Node: Tie-in Recovery172454 -Node: Debugging174626 -Node: Invocation177927 -Node: Bison Options178657 -Node: Environment Variables182168 -Node: Option Cross Key183016 -Node: VMS Invocation183906 -Node: Table of Symbols184690 -Node: Glossary192266 -Node: Index198556 +Node: Top1306 +Node: Introduction8542 +Node: Conditions9817 +Node: Copying11281 +Node: Concepts30473 +Node: Language and Grammar31506 +Node: Grammar in Bison36522 +Node: Semantic Values38446 +Node: Semantic Actions40547 +Node: Bison Parser41730 +Node: Stages44040 +Node: Grammar Layout45323 +Node: Examples46580 +Node: RPN Calc47715 +Node: Rpcalc Decls48689 +Node: Rpcalc Rules50276 +Node: Rpcalc Input52076 +Node: Rpcalc Line53537 +Node: Rpcalc Expr54652 +Node: Rpcalc Lexer56597 +Node: Rpcalc Main59169 +Node: Rpcalc Error59567 +Node: Rpcalc Gen60575 +Node: Rpcalc Compile61724 +Node: Infix Calc62599 +Node: Simple Error Recovery65306 +Node: Multi-function Calc67192 +Node: Mfcalc Decl68758 +Node: Mfcalc Rules70781 +Node: Mfcalc Symtab72161 +Node: Exercises78534 +Node: Grammar File79040 +Node: Grammar Outline79808 +Node: C Declarations80542 +Node: Bison Declarations81122 +Node: Grammar Rules81534 +Node: C Code81994 +Node: Symbols82924 +Node: Rules88005 +Node: Recursion89644 +Node: Semantics91363 +Node: Value Type92460 +Node: Multiple Types93132 +Node: Actions94149 +Node: Action Types96934 +Node: Mid-Rule Actions98237 +Node: Declarations103806 +Node: Token Decl105125 +Node: Precedence Decl107138 +Node: Union Decl108689 +Node: Type Decl109533 +Node: Expect Decl110439 +Node: Start Decl111985 +Node: Pure Decl112363 +Node: Decl Summary114040 +Node: Multiple Parsers119423 +Node: Interface120917 +Node: Parser Function121789 +Node: Lexical122624 +Node: Calling Convention124030 +Node: Token Values126801 +Node: Token Positions127950 +Node: Pure Calling128842 +Node: Error Reporting131774 +Node: Action Features133896 +Node: Algorithm137557 +Node: Look-Ahead139850 +Node: Shift/Reduce141982 +Node: Precedence144894 +Node: Why Precedence145545 +Node: Using Precedence147410 +Node: Precedence Examples148378 +Node: How Precedence149079 +Node: Contextual Precedence150228 +Node: Parser States152019 +Node: Reduce/Reduce153262 +Node: Mystery Conflicts156823 +Node: Stack Overflow160209 +Node: Error Recovery161582 +Node: Context Dependency166718 +Node: Semantic Tokens167566 +Node: Lexical Tie-ins170583 +Node: Tie-in Recovery172131 +Node: Debugging174303 +Node: Invocation177604 +Node: Bison Options178334 +Node: Environment Variables181768 +Node: Option Cross Key182616 +Node: VMS Invocation183460 +Node: Table of Symbols184244 +Node: Glossary191643 +Node: Index197933  End Tag Table diff --git a/doc/bison.info-1 b/doc/bison.info-1 index 9a8c124c..37f759cc 100644 --- a/doc/bison.info-1 +++ b/doc/bison.info-1 @@ -1,4 +1,5 @@ -This is bison.info, produced by makeinfo version 4.0 from bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à +partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). diff --git a/doc/bison.info-2 b/doc/bison.info-2 index 424d4b60..6433a01c 100644 --- a/doc/bison.info-2 +++ b/doc/bison.info-2 @@ -1,4 +1,5 @@ -This is bison.info, produced by makeinfo version 4.0 from bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à +partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). diff --git a/doc/bison.info-3 b/doc/bison.info-3 index 8aa0408b..06106f47 100644 --- a/doc/bison.info-3 +++ b/doc/bison.info-3 @@ -1,4 +1,5 @@ -This is bison.info, produced by makeinfo version 4.0 from bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à +partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). @@ -530,13 +531,6 @@ Bison Declaration Summary called `foo.tab.c' by default. As a consequence, the verbose output file is called `foo.output'. -`%raw' - The output file `NAME.h' normally defines the tokens with - Yacc-compatible token numbers. If this option is specified, the - internal Bison numbers are used instead. (Yacc-compatible numbers - start at 257 except for single-character tokens; Bison assigns - token numbers sequentially for all tokens starting at 3.) - `%token_table' Generate an array of token names in the parser file. The name of the array is `yytname'; `yytname[I]' is the name of the token diff --git a/doc/bison.info-4 b/doc/bison.info-4 index 0aeba7c6..05b06496 100644 --- a/doc/bison.info-4 +++ b/doc/bison.info-4 @@ -1,4 +1,5 @@ -This is bison.info, produced by makeinfo version 4.0 from bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à +partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). @@ -884,10 +885,6 @@ Tuning the parser: `--no-parser' Pretend that `%no_parser' was specified. *Note Decl Summary::. -`-r' -`--raw' - Pretend that `%raw' was specified. *Note Decl Summary::. - `-k' `--token-table' Pretend that `%token_table' was specified. *Note Decl Summary::. @@ -959,7 +956,6 @@ find the corresponding short option. --no-lines -l --no-parser -n --output-file=OUTFILE -o OUTFILE - --raw -r --token-table -k --verbose -v --version -V @@ -1146,11 +1142,6 @@ Bison Symbols Bison declaration to request a pure (reentrant) parser. *Note A Pure (Reentrant) Parser: Pure Decl. -`%raw' - Bison declaration to use Bison internal token code numbers in token - tables instead of the usual Yacc-compatible token code numbers. - *Note Decl Summary::. - `%right' Bison declaration to assign right associativity to token(s). *Note Operator Precedence: Precedence Decl. diff --git a/doc/bison.info-5 b/doc/bison.info-5 index 88fc25fb..a917e95c 100644 --- a/doc/bison.info-5 +++ b/doc/bison.info-5 @@ -1,4 +1,5 @@ -This is bison.info, produced by makeinfo version 4.0 from bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à +partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). diff --git a/doc/bison.texinfo b/doc/bison.texinfo index c26a2295..29ce7b69 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -3258,13 +3258,6 @@ Therefore, if the input file is @file{foo.y}, then the parser file is called @file{foo.tab.c} by default. As a consequence, the verbose output file is called @file{foo.output}.@refill -@item %raw -The output file @file{@var{name}.h} normally defines the tokens with -Yacc-compatible token numbers. If this option is specified, the -internal Bison numbers are used instead. (Yacc-compatible numbers start -at 257 except for single-character tokens; Bison assigns token numbers -sequentially for all tokens starting at 3.) - @item %token_table Generate an array of token names in the parser file. The name of the array is @code{yytname}; @code{yytname[@var{i}]} is the name of the @@ -5025,10 +5018,6 @@ parser file, treating it as an independent source file in its own right. @itemx --no-parser Pretend that @code{%no_parser} was specified. @xref{Decl Summary}. -@item -r -@itemx --raw -Pretend that @code{%raw} was specified. @xref{Decl Summary}. - @item -k @itemx --token-table Pretend that @code{%token_table} was specified. @xref{Decl Summary}. @@ -5108,7 +5097,6 @@ the corresponding short option. \line{ --no-lines \leaderfill -l} \line{ --no-parser \leaderfill -n} \line{ --output-file \leaderfill -o} -\line{ --raw \leaderfill -r} \line{ --token-table \leaderfill -k} \line{ --verbose \leaderfill -v} \line{ --version \leaderfill -V} @@ -5127,7 +5115,6 @@ the corresponding short option. --no-lines -l --no-parser -n --output-file=@var{outfile} -o @var{outfile} ---raw -r --token-table -k --verbose -v --version -V @@ -5315,11 +5302,6 @@ Bison declaration to assign a precedence to a specific rule. Bison declaration to request a pure (reentrant) parser. @xref{Pure Decl, ,A Pure (Reentrant) Parser}. -@item %raw -Bison declaration to use Bison internal token code numbers in token -tables instead of the usual Yacc-compatible token code numbers. -@xref{Decl Summary}. - @item %right Bison declaration to assign right associativity to token(s). @xref{Precedence Decl, ,Operator Precedence}. diff --git a/doc/stamp-vti b/doc/stamp-vti index 9f5acf10..004cad4e 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 16 March 2001 +@set UPDATED 18 July 2001 @set EDITION 1.28a @set VERSION 1.28a diff --git a/doc/version.texi b/doc/version.texi index 9f5acf10..004cad4e 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 16 March 2001 +@set UPDATED 18 July 2001 @set EDITION 1.28a @set VERSION 1.28a diff --git a/src/getargs.c b/src/getargs.c index 890179ec..6c74d264 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -29,7 +29,6 @@ int defines_flag = 0; int locations_flag = 0; int no_lines_flag = 0; int no_parser_flag = 0; -int raw_flag = 0; char *skeleton = 0; int token_table_flag = 0; int verbose_flag = 0; @@ -106,7 +105,6 @@ Parser:\n\ -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\ -l, --no-lines don't generate `#line' directives\n\ -n, --no-parser generate the tables only\n\ - -r, --raw number the tokens from 3\n\ -k, --token-table include a table of token names\n\ "), stream); putc ('\n', stream); @@ -199,7 +197,7 @@ getargs (int argc, char *argv[]) break; case 'r': - raw_flag = 1; + fatal (_("`%s' is no longer supported"), "--raw"); break; case 'n': diff --git a/src/getargs.h b/src/getargs.h index e86d4335..4793f1a1 100644 --- a/src/getargs.h +++ b/src/getargs.h @@ -31,7 +31,6 @@ extern int defines_flag; /* for -d */ extern int locations_flag; extern int no_lines_flag; /* for -l */ extern int no_parser_flag; /* for -n */ -extern int raw_flag; /* for -r */ extern int statistics_flag; extern int token_table_flag; /* for -k */ extern int verbose_flag; /* for -v */ diff --git a/src/lex.c b/src/lex.c index 4eefa737..ec229a75 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. @@ -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 */ @@ -616,15 +616,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; } diff --git a/src/lex.h b/src/lex.h index f1425bd2..14a4db49 100644 --- a/src/lex.h +++ b/src/lex.h @@ -1,5 +1,5 @@ /* Token type definitions for bison's input reader, - Copyright 1984, 1989, 1992, 2000 Free Software Foundation, Inc. + Copyright 1984, 1989, 1992, 2000, 2001 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -49,7 +49,8 @@ typedef enum token_e tok_thong, tok_noop, tok_setopt, - tok_illegal + tok_illegal, + tok_obsolete } token_t; extern char *token_buffer; diff --git a/src/reader.c b/src/reader.c index fdd483ae..08b0983c 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1600,8 +1600,7 @@ output_token_defines (struct obstack *oout) obstack_fgrow2 (oout, "#define\t%s\t%d\n", symbol, - ((translations && !raw_flag) - ? bp->user_token_number : bp->value)); + (translations ? bp->user_token_number : bp->value)); if (semantic_parser) obstack_fgrow2 (oout, "#define\tT%s\t%d\n", symbol, bp->value); } diff --git a/tests/calc.at b/tests/calc.at index 9a8acc56..40f23fd8 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -331,8 +331,6 @@ AT_CLEANUP(calc calc.c calc.h calc.output) # ------------------ # AT_CHECK_CALC() -# This one is very suspicious. The test fails, but it might be normal. -AT_CHECK_CALC([--raw]) AT_CHECK_CALC([--defines]) AT_CHECK_CALC([--locations]) -- 2.45.2