glr.c: no longer support YYERROR_VERBOSE

* data/skeletons/glr.c: Rather, dispatch directly on parse.error's
value.
This commit is contained in:
Akim Demaille
2020-01-03 11:45:27 +01:00
parent 7122d747cf
commit 86a3ec0f8d

View File

@@ -241,14 +241,6 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]], ]b4_defines_if([[#include "@basename(]b4_spec_header_file[@)"]],
[b4_shared_declarations])[ [b4_shared_declarations])[
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
#endif
/* Default (constant) value used for initialization for null /* Default (constant) value used for initialization for null
right-hand sides. Unlike the standard yacc.c template, here we set right-hand sides. Unlike the standard yacc.c template, here we set
the default value of $$ to a zeroed-out value. Since the default the default value of $$ to a zeroed-out value. Since the default
@@ -376,7 +368,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
}; };
#endif #endif
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[ #if ]b4_error_verbose_if([[1]], [b4_api_PREFIX[DEBUG || ]b4_token_table_flag])[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
@@ -567,9 +559,8 @@ static void yypdumpstack (struct yyGLRStack* yystackp)
#endif #endif
#if YYERROR_VERBOSE ]m4_case(b4_percent_define_get([parse.error]), [verbose],
[[# ifndef yystpcpy
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy # define yystpcpy stpcpy
# else # else
@@ -639,8 +630,7 @@ yytnamerr (char *yyres, const char *yystr)
return YY_CAST (ptrdiff_t, strlen (yystr)); return YY_CAST (ptrdiff_t, strlen (yystr));
} }
# endif # endif
]])[
#endif /* !YYERROR_VERBOSE */
/** State numbers. */ /** State numbers. */
typedef int yyStateNum; typedef int yyStateNum;
@@ -756,7 +746,7 @@ yyMemoryExhausted (yyGLRStack* yystackp)
YYLONGJMP (yystackp->yyexception_buffer, 2); YYLONGJMP (yystackp->yyexception_buffer, 2);
} }
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE #if ]b4_error_verbose_if([[1]], [b4_api_PREFIX[DEBUG]])[
/** A printable representation of TOKEN. */ /** A printable representation of TOKEN. */
static inline const char* static inline const char*
yytokenName (yySymbol yytoken) yytokenName (yySymbol yytoken)
@@ -2075,10 +2065,11 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{ {
if (yystackp->yyerrState != 0) if (yystackp->yyerrState != 0)
return; return;
#if ! YYERROR_VERBOSE ]m4_case(b4_percent_define_get([parse.error]),
yyerror (]b4_lyyerror_args[YY_("syntax error")); [simple],
#else [[ yyerror (]b4_lyyerror_args[YY_("syntax error"));]],
{ [verbose],
[[ {
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
yybool yysize_overflow = yyfalse; yybool yysize_overflow = yyfalse;
char* yymsg = YY_NULLPTR; char* yymsg = YY_NULLPTR;
@@ -2203,8 +2194,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
yyerror (]b4_lyyerror_args[YY_("syntax error")); yyerror (]b4_lyyerror_args[YY_("syntax error"));
yyMemoryExhausted (yystackp); yyMemoryExhausted (yystackp);
} }
} }]])[
#endif /* YYERROR_VERBOSE */
yynerrs += 1; yynerrs += 1;
} }