[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
yacc: remove support for YYPRINT
From: |
Akim Demaille |
Subject: |
yacc: remove support for YYPRINT |
Date: |
Mon, 1 Feb 2021 06:50:22 +0100 |
commit 9b07e04f4f2443448b724ca7bb46c5321ba66893
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Mon Feb 1 06:45:15 2021 +0100
yacc: remove support for YYPRINT
Its removal was annonced several times in NEWS (for Bison 3.5, 3.6, 3.7).
* data/skeletons/c.m4, data/skeletons/yacc.c: Remove support for YYPRINT.
* NEWS: Fix the mess introduced by the merge.
Document the removal of YYPRINT.
* doc/bison.texi (The YYPRINT Macro): Remove.
diff --git a/NEWS b/NEWS
index 8434ac258..fe6dda6f7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
GNU Bison NEWS
-* Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
+* Noteworthy changes in release ?.? (????-??-??) [?]
** Deprecated features
@@ -9,26 +9,9 @@ GNU Bison NEWS
with Yacc, but not in C++. Warnings are now issued if `#define YYSTYPE`
is used in C++, and eventually support will be removed.
-** Bug fixes
-
-*** Counterexample Generation
-
- In some cases counterexample generation could crash. This is fixed.
-
-*** Fix Table Generation
-
- In some very rare conditions, when there are many useless tokens, it was
- possible to generate incorrect parsers.
-
-*** GLR parsers now support %merge together with api.value.type=union.
-
-*** C++ parsers use noexcept in more places.
-
-*** Generated parsers avoid some warnings about signedness issues.
-
-*** C-language parsers now avoid warnings from pedantic clang.
-
-*** C-language parsers now work around quirks of HP-UX 11.23 (2003).
+ Support for the YYPRINT macro is removed. It worked only with yacc.c and
+ only for tokens. It was obsoleted by %printer, introduced in Bison 1.50
+ (November 2002).
** Changes
@@ -98,6 +81,30 @@ GNU Bison NEWS
memory exhaustion.
+* Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
+
+** Bug fixes
+
+*** Counterexample Generation
+
+ In some cases counterexample generation could crash. This is fixed.
+
+*** Fix Table Generation
+
+ In some very rare conditions, when there are many useless tokens, it was
+ possible to generate incorrect parsers.
+
+*** GLR parsers now support %merge together with api.value.type=union.
+
+*** C++ parsers use noexcept in more places.
+
+*** Generated parsers avoid some warnings about signedness issues.
+
+*** C-language parsers now avoid warnings from pedantic clang.
+
+*** C-language parsers now work around quirks of HP-UX 11.23 (2003).
+
+
* Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
** Bug fixes
diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4
index 0bc0d7a6f..a8e1a9d4a 100644
--- a/data/skeletons/c.m4
+++ b/data/skeletons/c.m4
@@ -761,13 +761,6 @@ yy_symbol_value_print (FILE *yyo,
]b4_parse_param_use([yyoutput], [yylocationp])dnl
[ if (!yyvaluep)
return;]
-dnl glr.c does not feature yytoknum.
-m4_if(b4_skeleton, ["yacc.c"],
-[[# ifdef YYPRINT
- if (yykind < YYNTOKENS)
- YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
-# endif
-]])dnl
b4_percent_code_get([[pre-printer]])dnl
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
b4_symbol_actions([printer])
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index f80d4b712..4ec2549c7 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -703,15 +703,6 @@ yysymbol_name (yysymbol_kind_t yysymbol)
}]])[
#endif
-#ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
-{
- ]b4_toknum[
-};
-#endif
-
#define YYPACT_NINF (]b4_pact_ninf[)
#define yypact_value_is_default(Yyn) \
diff --git a/doc/bison.texi b/doc/bison.texi
index d773ddd59..5057ceda5 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -478,7 +478,6 @@ Tracing Your Parser
* Enabling Traces:: Activating run-time trace support
* Mfcalc Traces:: Extending @code{mfcalc} to support traces
-* The YYPRINT Macro:: Obsolete interface for semantic value reports
Invoking Bison
@@ -11070,7 +11069,6 @@ When a Bison grammar compiles properly but parses
``incorrectly'', the
@menu
* Enabling Traces:: Activating run-time trace support
* Mfcalc Traces:: Extending @code{mfcalc} to support traces
-* The YYPRINT Macro:: Obsolete interface for semantic value reports
@end menu
@node Enabling Traces
@@ -11334,49 +11332,6 @@ Cleanup: popping nterm input ()
@end example
-@node The YYPRINT Macro
-@subsection The @code{YYPRINT} Macro
-@findex YYPRINT
-
-The @code{%printer} directive was introduced in Bison 1.50 (November 2002).
-Before then, @code{YYPRINT} provided a similar feature, but only for
-terminal symbols and only with the @file{yacc.c} skeleton.
-
-@deffn {Macro} YYPRINT (@var{stream}, @var{token}, @var{value});
-@findex YYPRINT
-Deprecated, will be removed eventually.
-
-If you define @code{YYPRINT}, it should take three arguments. The parser
-will pass a standard I/O stream, the numeric code for the token kind, and
-the token value (from @code{yylval}).
-
-For @file{yacc.c} only. Obsoleted by @code{%printer}.
-@end deffn
-
-Here is an example of @code{YYPRINT} suitable for the multi-function
-calculator (@pxref{Mfcalc Declarations}):
-
-@example
-%@{
- static void print_token_value (FILE *file, int type, YYSTYPE value);
- #define YYPRINT(File, Type, Value) \
- print_token_value (File, Type, Value)
-%@}
-
-@dots{} %% @dots{} %% @dots{}
-
-static void
-print_token_value (FILE *file, yytoken_kind_t kind, YYSTYPE value)
-@{
- if (kind == VAR)
- fprintf (file, "%s", value.tptr->name);
- else if (kind == NUM)
- fprintf (file, "%d", value.val);
-@}
-@end example
-
-@xref{Mfcalc Traces}, for the proper use of @code{%printer}.
-
@c ================================================= Invoking Bison
@node Invocation
@@ -16146,12 +16101,6 @@ The parser function produced by Bison; call this
function to start
parsing. @xref{Parser Function}.
@end deffn
-@deffn {Macro} YYPRINT
-Macro used to output token semantic values. For @file{yacc.c} only.
-Deprecated, use @code{%printer} instead (@pxref{Printer Decl}).
-@xref{The YYPRINT Macro}.
-@end deffn
-
@deffn {Function} yypstate_delete
The function to delete a parser instance, produced by Bison in push mode;
call this function to delete the memory associated with a parser.
@@ -16593,7 +16542,7 @@ London, Department of Computer Science, TR-00-12
(December 2000).
@c LocalWords: symrec val tptr FUN func struct sym enum IEC syntaxes Byacc
@c LocalWords: fun putsym getsym arith funs atan ptr malloc sizeof Lex pcc
@c LocalWords: strlen strcpy fctn strcmp isalpha symbuf realloc isalnum DOTDOT
-@c LocalWords: ptypes itype YYPRINT trigraphs yytname expseq vindex dtype Unary
+@c LocalWords: ptypes itype trigraphs yytname expseq vindex dtype Unary
@c LocalWords: Rhs YYRHSLOC LE nonassoc op deffn typeless yynerrs nonterminal
@c LocalWords: yychar yydebug msg YYNTOKENS YYNNTS YYNRULES YYNSTATES reentrant
@c LocalWords: cparse clex deftypefun NE defmac YYACCEPT YYABORT param yypstate
diff --git a/src/parse-gram.c b/src/parse-gram.c
index b826a9558..0ce97a10d 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.7.5.284-c9445. */
+/* A Bison parser, made by GNU Bison 3.7.5.297-b46a. */
/* Bison implementation for Yacc-like parsers in C
@@ -49,7 +49,7 @@
#define YYBISON 30705
/* Bison version string. */
-#define YYBISON_VERSION "3.7.5.284-c9445"
+#define YYBISON_VERSION "3.7.5.297-b46a"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -728,21 +728,6 @@ yysymbol_name (yysymbol_kind_t yysymbol)
}
#endif
-#ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_int16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315
-};
-#endif
-
#define YYPACT_NINF (-148)
#define yypact_value_is_default(Yyn) \
@@ -1051,7 +1036,7 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const
yylocp)
res += YYFPRINTF (yyo, "-%d", end_col);
}
return res;
- }
+}
# define YY_LOCATION_PRINT(File, Loc) \
yy_location_print_ (File, &(Loc))
@@ -1087,10 +1072,6 @@ yy_symbol_value_print (FILE *yyo,
YY_USE (yylocationp);
if (!yyvaluep)
return;
-# ifdef YYPRINT
- if (yykind < YYNTOKENS)
- YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
-# endif
/* "%code pre-printer" blocks. */
tron (yyo);
diff --git a/src/parse-gram.h b/src/parse-gram.h
index 8136581d3..10a635285 100644
--- a/src/parse-gram.h
+++ b/src/parse-gram.h
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.7.5.284-c9445. */
+/* A Bison parser, made by GNU Bison 3.7.5.297-b46a. */
/* Bison interface for Yacc-like parsers in C
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- yacc: remove support for YYPRINT,
Akim Demaille <=