[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] yacc.c: simplify initialization of push parsers
From: |
Akim Demaille |
Subject: |
[PATCH 5/7] yacc.c: simplify initialization of push parsers |
Date: |
Sun, 28 Jun 2020 16:52:18 +0200 |
The previous commit ("yacc.c: declare and initialize and the same
time") made b4_initialize_parser_state_variables useless.
* data/skeletons/yacc.c (b4_initialize_parser_state_variables): Inline
into...
(yypstate_clear): here.
---
data/skeletons/yacc.c | 34 +++++++++++++---------------------
1 file changed, 13 insertions(+), 21 deletions(-)
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 9a4abeac..c78a5a78 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -219,26 +219,6 @@ m4_define([b4_declare_parser_state_variables],
[ : YYMAXDEPTH])])[;]])])
-# b4_initialize_parser_state_variables
-# ------------------------------------
-# Initialize these variables.
-m4_define([b4_initialize_parser_state_variables],
-[[ yynerrs = 0;
- yystate = 0;
- yyerrstatus = 0;
-
- yystacksize = YYINITDEPTH;
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;]b4_locations_if([[
- yylsp = yyls = yylsa;]])[]b4_lac_if([[
-
- yyes = yyesa;
- yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
- if (YYMAXDEPTH < yyes_capacity)
- yyes_capacity = YYMAXDEPTH;]])[
-]])
-
-
m4_define([b4_macro_define],
[[#]define $1 $2])
@@ -1480,7 +1460,19 @@ yypull_parse (yypstate *yyps]b4_user_formals[)
static void
yypstate_clear (yypstate *yyps)
{
-]b4_initialize_parser_state_variables[
+ yynerrs = 0;
+ yystate = 0;
+ yyerrstatus = 0;
+
+ yystacksize = YYINITDEPTH;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;]b4_locations_if([[
+ yylsp = yyls = yylsa;]])[]b4_lac_if([[
+
+ yyes = yyesa;
+ yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
+ if (YYMAXDEPTH < yyes_capacity)
+ yyes_capacity = YYMAXDEPTH;]])[
/* Initialize the state stack, in case yypcontext_expected_tokens is
called before the first call to yyparse. */
*yyssp = 0;
--
2.27.0
- [PATCH 0/7] RFC: yypstate_clear (ATTENTION push parser users), Akim Demaille, 2020/06/28
- [PATCH 1/7] yacc.c: simplify yypull_parse, Akim Demaille, 2020/06/28
- [PATCH 2/7] yacc.c: style changes in push mode, Akim Demaille, 2020/06/28
- [PATCH 3/7] yacc.c: declare and initialize and the same time, Akim Demaille, 2020/06/28
- [PATCH 4/7] regen, Akim Demaille, 2020/06/28
- [PATCH 5/7] yacc.c: simplify initialization of push parsers,
Akim Demaille <=
- [PATCH 6/7] bistromathic: don't display undefined locations, Akim Demaille, 2020/06/28
- [PATCH 7/7] yacc.c: push: don't clear the parser state when accepting/rejecting, Akim Demaille, 2020/06/28