help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Removing --raw


From: Akim Demaille
Subject: Removing --raw
Date: 18 Jul 2001 11:51:14 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

Thanks for your proposal (sent privately), but I have a few comments.

First of all, please do not send a single patch which address several
very different issues.  I have split this one, but I'd like to avoid
having to do it for other patches.

Also, since you are removing a feature, I think the simplest and
sanest for the users is simply to completely remove it from all the
documentation.  You also forgot to address the %raw keyword.  I try to
keep generic sentences in error messages so that the translators don't
have similar but different messages to translate.  Also, I prefer to
keep the error code local to --raw/%raw handling, i.e., remove the
global variable too.  And finally, please try to keep NEWS up to date.

Basically, here is what I did out of your patch:

Index: ChangeLog
from  Pascal Bart  <address@hidden>

        * 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'.

Index: NEWS
===================================================================
RCS file: /cvs/bison/NEWS,v
retrieving revision 1.13
diff -u -u -r1.13 NEWS
--- NEWS 2001/03/16 15:16:07 1.13
+++ NEWS 2001/07/18 09:50:16
@@ -13,6 +13,8 @@
 
 * 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.
 
Index: doc/bison.1
===================================================================
RCS file: /cvs/bison/doc/bison.1,v
retrieving revision 1.5
diff -u -u -r1.5 bison.1
--- doc/bison.1 1999/06/08 19:00:57 1.5
+++ doc/bison.1 2001/07/18 09:50:16
@@ -32,10 +32,6 @@
 ] [
 .BI \-\-name-prefix= prefix
 ] [
-.B \-r
-] [
-.B \-\-raw
-] [
 .B \-t
 ] [
 .B \-\-debug
@@ -140,31 +136,20 @@
 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 @@
 .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 @@
 .BR yylex ,
 .BR yyerror ,
 .BR yylval ,
-.BR yychar , 
+.BR yychar ,
 and
 .BR yydebug .
 .sp
@@ -241,7 +226,7 @@
 .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
Index: doc/bison.texinfo
===================================================================
RCS file: /cvs/bison/doc/bison.texinfo,v
retrieving revision 1.27
diff -u -u -r1.27 bison.texinfo
--- doc/bison.texinfo 2001/03/16 15:32:48 1.27
+++ doc/bison.texinfo 2001/07/18 09:50:17
@@ -3258,13 +3258,6 @@
 called @file{foo.tab.c} by default.  As a consequence, the verbose
 output file is called @address@hidden
 
address@hidden %raw
-The output file @address@hidden 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}; @address@hidden is the name of the
@@ -5025,10 +5018,6 @@
 @itemx --no-parser
 Pretend that @code{%no_parser} was specified.  @xref{Decl Summary}.
 
address@hidden -r
address@hidden --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 @@
 \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 @@
 --no-lines                            -l
 --no-parser                           -n
 address@hidden                 -o @var{outfile}
---raw                                 -r
 --token-table                         -k
 --verbose                             -v
 --version                             -V
@@ -5314,11 +5301,6 @@
 @item %pure_parser
 Bison declaration to request a pure (reentrant) parser.
 @xref{Pure Decl, ,A Pure (Reentrant) Parser}.
-
address@hidden %raw
-Bison declaration to use Bison internal token code numbers in token
-tables instead of the usual Yacc-compatible token code numbers.
address@hidden Summary}.
 
 @item %right
 Bison declaration to assign right associativity to token(s).
Index: doc/stamp-vti
===================================================================
RCS file: /cvs/bison/doc/stamp-vti,v
retrieving revision 1.3
diff -u -u -r1.3 stamp-vti
--- doc/stamp-vti 2001/03/16 15:16:07 1.3
+++ doc/stamp-vti 2001/07/18 09:50:17
@@ -1,3 +1,3 @@
address@hidden UPDATED 16 March 2001
address@hidden UPDATED 18 July 2001
 @set EDITION 1.28a
 @set VERSION 1.28a
Index: doc/version.texi
===================================================================
RCS file: /cvs/bison/doc/version.texi,v
retrieving revision 1.1
diff -u -u -r1.1 version.texi
--- doc/version.texi 2001/07/17 14:23:04 1.1
+++ doc/version.texi 2001/07/18 09:50:17
@@ -1,3 +1,3 @@
address@hidden UPDATED 16 March 2001
address@hidden UPDATED 18 July 2001
 @set EDITION 1.28a
 @set VERSION 1.28a
Index: src/getargs.c
===================================================================
RCS file: /cvs/bison/src/getargs.c,v
retrieving revision 1.21
diff -u -u -r1.21 getargs.c
--- src/getargs.c 2001/03/16 15:16:08 1.21
+++ src/getargs.c 2001/07/18 09:50:18
@@ -29,7 +29,6 @@
 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 @@
   -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 @@
        break;
 
       case 'r':
-       raw_flag = 1;
+       fatal (_("`%s' is no longer supported"), "--raw");
        break;
 
       case 'n':
Index: src/getargs.h
===================================================================
RCS file: /cvs/bison/src/getargs.h,v
retrieving revision 1.7
diff -u -u -r1.7 getargs.h
--- src/getargs.h 2001/03/16 15:16:08 1.7
+++ src/getargs.h 2001/07/18 09:50:18
@@ -31,7 +31,6 @@
 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 */
Index: src/lex.c
===================================================================
RCS file: /cvs/bison/src/lex.c,v
retrieving revision 1.29
diff -u -u -r1.29 lex.c
--- src/lex.c 2001/02/02 14:56:44 1.29
+++ src/lex.c 2001/07/18 09:50:18
@@ -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 @@
   { "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 @@
     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;
 }
Index: src/lex.h
===================================================================
RCS file: /cvs/bison/src/lex.h,v
retrieving revision 1.10
diff -u -u -r1.10 lex.h
--- src/lex.h 2001/01/19 18:10:32 1.10
+++ src/lex.h 2001/07/18 09:50:18
@@ -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 @@
     tok_thong,
     tok_noop,
     tok_setopt,
-    tok_illegal
+    tok_illegal,
+    tok_obsolete
   } token_t;
 
 extern char *token_buffer;
Index: src/reader.c
===================================================================
RCS file: /cvs/bison/src/reader.c,v
retrieving revision 1.65
diff -u -u -r1.65 reader.c
--- src/reader.c 2001/02/21 10:17:25 1.65
+++ src/reader.c 2001/07/18 09:50:19
@@ -1600,8 +1600,7 @@
 
       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);
     }
Index: tests/calc.at
===================================================================
RCS file: /cvs/bison/tests/calc.at,v
retrieving revision 1.2
diff -u -u -r1.2 calc.at
--- tests/calc.at 2000/12/19 18:14:35 1.2
+++ tests/calc.at 2001/07/18 09:50:19
@@ -331,8 +331,6 @@
 # ------------------ #
 
 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])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]