[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/12] yacc.c: style: avoid macros
From: |
Akim Demaille |
Subject: |
[PATCH 03/12] yacc.c: style: avoid macros |
Date: |
Thu, 16 Jan 2020 07:58:14 +0100 |
* data/skeletons/yacc.c (YYSYNTAX_ERROR): Remove, the call is now
sufficiently small so that we can afford to duplicate it.
---
data/skeletons/yacc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 4f088036..ff53b8d0 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1789,25 +1789,26 @@ yyerrlab:
[simple],
[[ yyerror (]b4_yyerror_args[YY_("syntax error"));]],
[verbose],
-[[# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, &yyctx)
- {
+[[ {
char const *yymsgp = YY_("syntax error");
yyparse_context_t yyctx
= {yyssp, yytoken]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])[};
int yysyntax_error_status;]b4_lac_if([[
if (yychar != YYEMPTY)
YY_LAC_ESTABLISH;]])[
- yysyntax_error_status = YYSYNTAX_ERROR;
+ yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
- yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T,
yymsg_alloc)));
+ yymsg = YY_CAST (char *,
+ YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
if (yymsg)
{
- yysyntax_error_status = YYSYNTAX_ERROR;
+ yysyntax_error_status
+ = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
yymsgp = yymsg;
}
else
@@ -1820,8 +1821,7 @@ yyerrlab:
yyerror (]b4_yyerror_args[yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR]])[
+ }]])[
}
]b4_locations_if([[ yyerror_range[1] = yylloc;]])[
--
2.24.1
- RFC: custom error messages, Akim Demaille, 2020/01/03
- Re: RFC: custom error messages, Christian Schoenebeck, 2020/01/03
- Re: RFC: custom error messages, Akim Demaille, 2020/01/05
- Re: RFC: custom error messages, Christian Schoenebeck, 2020/01/09
- Re: RFC: custom error messages, Akim Demaille, 2020/01/10
- Re: RFC: custom error messages, Christian Schoenebeck, 2020/01/14
- Re: RFC: custom error messages, Akim Demaille, 2020/01/14
- [PATCH 00/12] RFC: yyreport_error_message, Akim Demaille, 2020/01/16
- [PATCH 02/12] yacc.c: store token numbers, not token strings, Akim Demaille, 2020/01/16
- [PATCH 03/12] yacc.c: style: avoid macros,
Akim Demaille <=
- [PATCH 01/12] yacc.c: extract yyerror_message_arguments, Akim Demaille, 2020/01/16
- [PATCH 04/12] yacc.c: add custom error message generation, Akim Demaille, 2020/01/16
- [PATCH 06/12] tests: compute verbose error messages from the custom ones, Akim Demaille, 2020/01/16
- [PATCH 05/12] yacc.c: check custom error messages, Akim Demaille, 2020/01/16
- [PATCH 07/12] yacc.c: isolate yyexpected_tokens, Akim Demaille, 2020/01/16
- [PATCH 08/12] yacc.c: let custom error messages see the location, Akim Demaille, 2020/01/16
- [PATCH 09/12] yacc.c: check custom error messages with parse-params, Akim Demaille, 2020/01/16
- [PATCH 10/12] tests: a clearer test for parse-params, Akim Demaille, 2020/01/16
- [PATCH 12/12] yacc.c: portability to G++ 4.8, Akim Demaille, 2020/01/16
- [PATCH 11/12] yacc.c: pass the parse-params to yyreport_syntax_error, Akim Demaille, 2020/01/16