[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/7] style: reduce length of private constant
From: |
Akim Demaille |
Subject: |
[PATCH 2/7] style: reduce length of private constant |
Date: |
Sat, 21 Mar 2020 12:53:10 +0100 |
* data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/yacc.c
(YYERROR_VERBOSE_ARGS_MAXIMUM): Rename as...
(YYARGS_MAX): this.
* src/parse-gram.y (YYERROR_VERBOSE_ARGS_MAXIMUM): Rename as...
(ARGS_MAX): this.
---
data/skeletons/glr.c | 6 +++---
data/skeletons/lalr1.cc | 6 +++---
data/skeletons/yacc.c | 7 +++----
src/parse-gram.y | 8 ++++----
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index ed8d75e0..e9a020b6 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -2198,18 +2198,18 @@ yyreportSyntaxError (yyGLRStack*
yystackp]b4_user_formals[)
[[ {
yybool yysize_overflow = yyfalse;
char* yymsg = YY_NULLPTR;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ enum { YYARGS_MAX = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat: reported tokens (one for the "unexpected",
one per "expected"). */
- yySymbol yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ yySymbol yyarg[YYARGS_MAX];
/* Cumulated lengths of YYARG. */
ptrdiff_t yysize = 0;
/* Actual size of YYARG. */
int yycount
- = yysyntax_error_arguments (yystackp, yyarg, YYERROR_VERBOSE_ARGS_MAXIMUM);
+ = yysyntax_error_arguments (yystackp, yyarg, YYARGS_MAX);
if (yycount == -2)
yyMemoryExhausted (yystackp);
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index 2c50cdd7..e35b21c5 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -1467,10 +1467,10 @@ b4_dollar_popdef])[]dnl
]b4_parser_class[::yysyntax_error_ (const context& yyctx) const
{
// Its maximum.
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ enum { YYARGS_MAX = 5 };
// Arguments of yyformat.
- int yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yycount = yyctx.yysyntax_error_arguments (yyarg,
YYERROR_VERBOSE_ARGS_MAXIMUM);
+ int yyarg[YYARGS_MAX];
+ int yycount = yyctx.yysyntax_error_arguments (yyarg, YYARGS_MAX);
char const* yyformat = YY_NULLPTR;
switch (yycount)
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index b9adb84f..3a7b0b0b 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1367,18 +1367,17 @@ static int
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
const yyparse_context_t *yyctx)
{
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ enum { YYARGS_MAX = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat: reported tokens (one for the "unexpected",
one per "expected"). */
- int yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyarg[YYARGS_MAX];
/* Cumulated lengths of YYARG. */
YYPTRDIFF_T yysize = 0;
/* Actual size of YYARG. */
- int yycount
- = yysyntax_error_arguments (yyctx, yyarg, YYERROR_VERBOSE_ARGS_MAXIMUM);
+ int yycount = yysyntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
if (yycount == -2)
return 2;
diff --git a/src/parse-gram.y b/src/parse-gram.y
index e3bff55a..e26ae0a7 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -801,14 +801,14 @@ epilogue.opt:
int
yyreport_syntax_error (const yyparse_context_t *ctx)
{
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ enum { ARGS_MAX = 5 };
/* Arguments of format: reported tokens (one for the "unexpected",
one per "expected"). */
- int arg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int n = yysyntax_error_arguments (ctx, arg, YYERROR_VERBOSE_ARGS_MAXIMUM);
+ int arg[ARGS_MAX];
+ int n = yysyntax_error_arguments (ctx, arg, ARGS_MAX);
if (n == -2)
return 2;
- const char *argv[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ const char *argv[ARGS_MAX];
for (int i = 0; i < n; ++i)
argv[i] = yysymbol_name (arg[i]);
syntax_error (*yyparse_context_location (ctx), n, argv);
--
2.25.1
- [PATCH 0/7] Deprecate yysyntax_error_arguments, Akim Demaille, 2020/03/21
- [PATCH 1/7] doc: c++: promote api.token.raw, Akim Demaille, 2020/03/21
- [PATCH 2/7] style: reduce length of private constant,
Akim Demaille <=
- [PATCH 5/7] tests: yacc.c: avoid yysyntax_error_arguments, Akim Demaille, 2020/03/21
- [PATCH 3/7] yacc.c: use negative numbers for errors in auxiliary functions, Akim Demaille, 2020/03/21
- [PATCH 4/7] examples: don't use yysyntax_error_arguments, Akim Demaille, 2020/03/21
- [PATCH 7/7] lalr1.cc: avoid using yysyntax_error_arguments, Akim Demaille, 2020/03/21
- [PATCH 6/7] bison: avoid using yysyntax_error_arguments, Akim Demaille, 2020/03/21
- Re: [PATCH 0/7] Deprecate yysyntax_error_arguments, Akim Demaille, 2020/03/26