* 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'.
This commit is contained in:
Akim Demaille
2001-07-18 09:52:35 +00:00
parent 45bed1a559
commit 62ab6972e8
18 changed files with 150 additions and 181 deletions

View File

@@ -1,3 +1,11 @@
2001-07-05 Pascal Bart <pascal.bart@epita.fr>
* 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 <akim@epita.fr> 2001-07-14 Akim Demaille <akim@epita.fr>
* config/: New. * config/: New.

2
NEWS
View File

@@ -13,6 +13,8 @@ Changes in version 1.28a:
* Added `-S' and `--skeleton'. * Added `-S' and `--skeleton'.
* `%raw', `-r', `--raw' is disabled.
* Special characters are escaped when output. This solves the problems * Special characters are escaped when output. This solves the problems
of the #line lines with path names including backslashes. of the #line lines with path names including backslashes.

View File

@@ -32,10 +32,6 @@ bison \- GNU Project parser generator (yacc replacement)
] [ ] [
.BI \-\-name-prefix= prefix .BI \-\-name-prefix= prefix
] [ ] [
.B \-r
] [
.B \-\-raw
] [
.B \-t .B \-t
] [ ] [
.B \-\-debug .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 needs to be able to refer to token type codes and the variable
.BR yylval . .BR yylval .
.TP .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 .B \-k
.br .br
.ns .ns
.TP .TP
.B \-\-token-table .B \-\-token-table
This switch causes the \fIname\fB.tab.c\fR output to include a list of 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 token names in order by their token numbers; this is defined in the array
.IR yytname . .IR yytname .
Also generated Also generated
are #defines for are #defines for
.IR YYNTOKENS , .IR YYNTOKENS ,
.IR YYNNTS , .IR YYNNTS ,
.IR YYNRULES , .IR YYNRULES ,
and and
.IR YYNSTATES . .IR YYNSTATES .
.TP .TP
.B \-l .B \-l
@@ -188,10 +173,10 @@ parser file, treating it an independent source file in its own right.
.TP .TP
.B \-\-no-parser .B \-\-no-parser
Do not generate the parser code into the output; generate only 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 constant declarations. In addition, a \fIname\fB.act\fR file is
generated containing a switch statement body containing all the generated containing a switch statement body containing all the
translated actions. translated actions.
.TP .TP
.BI \-o " outfile" .BI \-o " outfile"
.br .br
@@ -224,7 +209,7 @@ The precise list of symbols renamed is
.BR yylex , .BR yylex ,
.BR yyerror , .BR yyerror ,
.BR yylval , .BR yylval ,
.BR yychar , .BR yychar ,
and and
.BR yydebug . .BR yydebug .
.sp .sp
@@ -241,7 +226,7 @@ and so on.
.TP .TP
.B \-\-debug .B \-\-debug
Output a definition of the macro Output a definition of the macro
.B YYDEBUG .B YYDEBUG
into the parser file, into the parser file,
so that the debugging facilities are compiled. so that the debugging facilities are compiled.
.TP .TP

View File

@@ -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 START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement). * bison: (bison). GNU Project parser generator (yacc replacement).
@@ -29,105 +30,105 @@ instead of in the original English.
 
Indirect: Indirect:
bison.info-1: 1285 bison.info-1: 1306
bison.info-2: 50255 bison.info-2: 50276
bison.info-3: 98216 bison.info-3: 98237
bison.info-4: 147733 bison.info-4: 147410
bison.info-5: 192266 bison.info-5: 191643
 
Tag Table: Tag Table:
(Indirect) (Indirect)
Node: Top1285 Node: Top1306
Node: Introduction8521 Node: Introduction8542
Node: Conditions9796 Node: Conditions9817
Node: Copying11260 Node: Copying11281
Node: Concepts30452 Node: Concepts30473
Node: Language and Grammar31485 Node: Language and Grammar31506
Node: Grammar in Bison36501 Node: Grammar in Bison36522
Node: Semantic Values38425 Node: Semantic Values38446
Node: Semantic Actions40526 Node: Semantic Actions40547
Node: Bison Parser41709 Node: Bison Parser41730
Node: Stages44019 Node: Stages44040
Node: Grammar Layout45302 Node: Grammar Layout45323
Node: Examples46559 Node: Examples46580
Node: RPN Calc47694 Node: RPN Calc47715
Node: Rpcalc Decls48668 Node: Rpcalc Decls48689
Node: Rpcalc Rules50255 Node: Rpcalc Rules50276
Node: Rpcalc Input52055 Node: Rpcalc Input52076
Node: Rpcalc Line53516 Node: Rpcalc Line53537
Node: Rpcalc Expr54631 Node: Rpcalc Expr54652
Node: Rpcalc Lexer56576 Node: Rpcalc Lexer56597
Node: Rpcalc Main59148 Node: Rpcalc Main59169
Node: Rpcalc Error59546 Node: Rpcalc Error59567
Node: Rpcalc Gen60554 Node: Rpcalc Gen60575
Node: Rpcalc Compile61703 Node: Rpcalc Compile61724
Node: Infix Calc62578 Node: Infix Calc62599
Node: Simple Error Recovery65285 Node: Simple Error Recovery65306
Node: Multi-function Calc67171 Node: Multi-function Calc67192
Node: Mfcalc Decl68737 Node: Mfcalc Decl68758
Node: Mfcalc Rules70760 Node: Mfcalc Rules70781
Node: Mfcalc Symtab72140 Node: Mfcalc Symtab72161
Node: Exercises78513 Node: Exercises78534
Node: Grammar File79019 Node: Grammar File79040
Node: Grammar Outline79787 Node: Grammar Outline79808
Node: C Declarations80521 Node: C Declarations80542
Node: Bison Declarations81101 Node: Bison Declarations81122
Node: Grammar Rules81513 Node: Grammar Rules81534
Node: C Code81973 Node: C Code81994
Node: Symbols82903 Node: Symbols82924
Node: Rules87984 Node: Rules88005
Node: Recursion89623 Node: Recursion89644
Node: Semantics91342 Node: Semantics91363
Node: Value Type92439 Node: Value Type92460
Node: Multiple Types93111 Node: Multiple Types93132
Node: Actions94128 Node: Actions94149
Node: Action Types96913 Node: Action Types96934
Node: Mid-Rule Actions98216 Node: Mid-Rule Actions98237
Node: Declarations103785 Node: Declarations103806
Node: Token Decl105104 Node: Token Decl105125
Node: Precedence Decl107117 Node: Precedence Decl107138
Node: Union Decl108668 Node: Union Decl108689
Node: Type Decl109512 Node: Type Decl109533
Node: Expect Decl110418 Node: Expect Decl110439
Node: Start Decl111964 Node: Start Decl111985
Node: Pure Decl112342 Node: Pure Decl112363
Node: Decl Summary114019 Node: Decl Summary114040
Node: Multiple Parsers119746 Node: Multiple Parsers119423
Node: Interface121240 Node: Interface120917
Node: Parser Function122112 Node: Parser Function121789
Node: Lexical122947 Node: Lexical122624
Node: Calling Convention124353 Node: Calling Convention124030
Node: Token Values127124 Node: Token Values126801
Node: Token Positions128273 Node: Token Positions127950
Node: Pure Calling129165 Node: Pure Calling128842
Node: Error Reporting132097 Node: Error Reporting131774
Node: Action Features134219 Node: Action Features133896
Node: Algorithm137880 Node: Algorithm137557
Node: Look-Ahead140173 Node: Look-Ahead139850
Node: Shift/Reduce142305 Node: Shift/Reduce141982
Node: Precedence145217 Node: Precedence144894
Node: Why Precedence145868 Node: Why Precedence145545
Node: Using Precedence147733 Node: Using Precedence147410
Node: Precedence Examples148701 Node: Precedence Examples148378
Node: How Precedence149402 Node: How Precedence149079
Node: Contextual Precedence150551 Node: Contextual Precedence150228
Node: Parser States152342 Node: Parser States152019
Node: Reduce/Reduce153585 Node: Reduce/Reduce153262
Node: Mystery Conflicts157146 Node: Mystery Conflicts156823
Node: Stack Overflow160532 Node: Stack Overflow160209
Node: Error Recovery161905 Node: Error Recovery161582
Node: Context Dependency167041 Node: Context Dependency166718
Node: Semantic Tokens167889 Node: Semantic Tokens167566
Node: Lexical Tie-ins170906 Node: Lexical Tie-ins170583
Node: Tie-in Recovery172454 Node: Tie-in Recovery172131
Node: Debugging174626 Node: Debugging174303
Node: Invocation177927 Node: Invocation177604
Node: Bison Options178657 Node: Bison Options178334
Node: Environment Variables182168 Node: Environment Variables181768
Node: Option Cross Key183016 Node: Option Cross Key182616
Node: VMS Invocation183906 Node: VMS Invocation183460
Node: Table of Symbols184690 Node: Table of Symbols184244
Node: Glossary192266 Node: Glossary191643
Node: Index198556 Node: Index197933
 
End Tag Table End Tag Table

View File

@@ -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 START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement). * bison: (bison). GNU Project parser generator (yacc replacement).

View File

@@ -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 START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement). * bison: (bison). GNU Project parser generator (yacc replacement).

View File

@@ -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 START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement). * 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 called `foo.tab.c' by default. As a consequence, the verbose
output file is called `foo.output'. 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' `%token_table'
Generate an array of token names in the parser file. The name of 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 the array is `yytname'; `yytname[I]' is the name of the token

View File

@@ -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 START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement). * bison: (bison). GNU Project parser generator (yacc replacement).
@@ -884,10 +885,6 @@ Tuning the parser:
`--no-parser' `--no-parser'
Pretend that `%no_parser' was specified. *Note Decl Summary::. Pretend that `%no_parser' was specified. *Note Decl Summary::.
`-r'
`--raw'
Pretend that `%raw' was specified. *Note Decl Summary::.
`-k' `-k'
`--token-table' `--token-table'
Pretend that `%token_table' was specified. *Note Decl Summary::. Pretend that `%token_table' was specified. *Note Decl Summary::.
@@ -959,7 +956,6 @@ find the corresponding short option.
--no-lines -l --no-lines -l
--no-parser -n --no-parser -n
--output-file=OUTFILE -o OUTFILE --output-file=OUTFILE -o OUTFILE
--raw -r
--token-table -k --token-table -k
--verbose -v --verbose -v
--version -V --version -V
@@ -1146,11 +1142,6 @@ Bison Symbols
Bison declaration to request a pure (reentrant) parser. *Note A Bison declaration to request a pure (reentrant) parser. *Note A
Pure (Reentrant) Parser: Pure Decl. 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' `%right'
Bison declaration to assign right associativity to token(s). Bison declaration to assign right associativity to token(s).
*Note Operator Precedence: Precedence Decl. *Note Operator Precedence: Precedence Decl.

View File

@@ -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 START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement). * bison: (bison). GNU Project parser generator (yacc replacement).

View File

@@ -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 called @file{foo.tab.c} by default. As a consequence, the verbose
output file is called @file{foo.output}.@refill 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 @item %token_table
Generate an array of token names in the parser file. The name of the 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 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 @itemx --no-parser
Pretend that @code{%no_parser} was specified. @xref{Decl Summary}. 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 @item -k
@itemx --token-table @itemx --token-table
Pretend that @code{%token_table} was specified. @xref{Decl Summary}. 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-lines \leaderfill -l}
\line{ --no-parser \leaderfill -n} \line{ --no-parser \leaderfill -n}
\line{ --output-file \leaderfill -o} \line{ --output-file \leaderfill -o}
\line{ --raw \leaderfill -r}
\line{ --token-table \leaderfill -k} \line{ --token-table \leaderfill -k}
\line{ --verbose \leaderfill -v} \line{ --verbose \leaderfill -v}
\line{ --version \leaderfill -V} \line{ --version \leaderfill -V}
@@ -5127,7 +5115,6 @@ the corresponding short option.
--no-lines -l --no-lines -l
--no-parser -n --no-parser -n
--output-file=@var{outfile} -o @var{outfile} --output-file=@var{outfile} -o @var{outfile}
--raw -r
--token-table -k --token-table -k
--verbose -v --verbose -v
--version -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. Bison declaration to request a pure (reentrant) parser.
@xref{Pure Decl, ,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 @item %right
Bison declaration to assign right associativity to token(s). Bison declaration to assign right associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}. @xref{Precedence Decl, ,Operator Precedence}.

View File

@@ -1,3 +1,3 @@
@set UPDATED 16 March 2001 @set UPDATED 18 July 2001
@set EDITION 1.28a @set EDITION 1.28a
@set VERSION 1.28a @set VERSION 1.28a

View File

@@ -1,3 +1,3 @@
@set UPDATED 16 March 2001 @set UPDATED 18 July 2001
@set EDITION 1.28a @set EDITION 1.28a
@set VERSION 1.28a @set VERSION 1.28a

View File

@@ -29,7 +29,6 @@ int defines_flag = 0;
int locations_flag = 0; int locations_flag = 0;
int no_lines_flag = 0; int no_lines_flag = 0;
int no_parser_flag = 0; int no_parser_flag = 0;
int raw_flag = 0;
char *skeleton = 0; char *skeleton = 0;
int token_table_flag = 0; int token_table_flag = 0;
int verbose_flag = 0; int verbose_flag = 0;
@@ -106,7 +105,6 @@ Parser:\n\
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\ -p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
-l, --no-lines don't generate `#line' directives\n\ -l, --no-lines don't generate `#line' directives\n\
-n, --no-parser generate the tables only\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\ -k, --token-table include a table of token names\n\
"), stream); "), stream);
putc ('\n', stream); putc ('\n', stream);
@@ -199,7 +197,7 @@ getargs (int argc, char *argv[])
break; break;
case 'r': case 'r':
raw_flag = 1; fatal (_("`%s' is no longer supported"), "--raw");
break; break;
case 'n': case 'n':

View File

@@ -31,7 +31,6 @@ extern int defines_flag; /* for -d */
extern int locations_flag; extern int locations_flag;
extern int no_lines_flag; /* for -l */ extern int no_lines_flag; /* for -l */
extern int no_parser_flag; /* for -n */ extern int no_parser_flag; /* for -n */
extern int raw_flag; /* for -r */
extern int statistics_flag; extern int statistics_flag;
extern int token_table_flag; /* for -k */ extern int token_table_flag; /* for -k */
extern int verbose_flag; /* for -v */ extern int verbose_flag; /* for -v */

View File

@@ -1,5 +1,5 @@
/* Token-reader for Bison's input parser, /* 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. This file is part of Bison, the GNU Compiler Compiler.
@@ -537,7 +537,7 @@ struct percent_table_struct percent_table[] =
{ "prec", NULL, tok_prec }, { "prec", NULL, tok_prec },
{ "locations", &locations_flag, tok_noop }, /* -l */ { "locations", &locations_flag, tok_noop }, /* -l */
{ "no_lines", &no_lines_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 */ { "token_table", &token_table_flag, tok_noop }, /* -k */
{ "yacc", &yacc_flag, tok_noop }, /* -y */ { "yacc", &yacc_flag, tok_noop }, /* -y */
{ "fixed_output_files",&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) if (strcmp (token_buffer + 1, tx->name) == 0)
break; break;
if (tx->retval == tok_setopt)
{
*((char **) (tx->set_flag)) = optarg;
return tok_noop;
}
if (tx->set_flag) if (tx->set_flag)
{ {
*((int *) (tx->set_flag)) = 1; *((int *) (tx->set_flag)) = 1;
return tok_noop; return tok_noop;
} }
switch (tx->retval)
{
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; return tx->retval;
} }

View File

@@ -1,5 +1,5 @@
/* Token type definitions for bison's input reader, /* 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. This file is part of Bison, the GNU Compiler Compiler.
@@ -49,7 +49,8 @@ typedef enum token_e
tok_thong, tok_thong,
tok_noop, tok_noop,
tok_setopt, tok_setopt,
tok_illegal tok_illegal,
tok_obsolete
} token_t; } token_t;
extern char *token_buffer; extern char *token_buffer;

View File

@@ -1600,8 +1600,7 @@ output_token_defines (struct obstack *oout)
obstack_fgrow2 (oout, "#define\t%s\t%d\n", obstack_fgrow2 (oout, "#define\t%s\t%d\n",
symbol, symbol,
((translations && !raw_flag) (translations ? bp->user_token_number : bp->value));
? bp->user_token_number : bp->value));
if (semantic_parser) if (semantic_parser)
obstack_fgrow2 (oout, "#define\tT%s\t%d\n", symbol, bp->value); obstack_fgrow2 (oout, "#define\tT%s\t%d\n", symbol, bp->value);
} }

View File

@@ -331,8 +331,6 @@ AT_CLEANUP(calc calc.c calc.h calc.output)
# ------------------ # # ------------------ #
AT_CHECK_CALC() 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([--defines])
AT_CHECK_CALC([--locations]) AT_CHECK_CALC([--locations])