[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
yacc.c: yyerror_range does not need to be preserved accross calls
From: |
Akim Demaille |
Subject: |
yacc.c: yyerror_range does not need to be preserved accross calls |
Date: |
Thu, 5 Mar 2020 17:59:25 +0100 |
commit 9cc76ee62c7e634b02532258ec68668f8d2f9781
Author: Akim Demaille <address@hidden>
Date: Wed Mar 4 00:28:59 2020 +0100
yacc.c: yyerror_range does not need to be preserved accross calls
* data/skeletons/yacc.c (b4_parse_state_variable_macros): Don't define
yyerror_range.
(yyparse): Add yyerror_range as local variable.
diff --git a/TODO b/TODO
index 46cc29ad..65f9148d 100644
--- a/TODO
+++ b/TODO
@@ -95,9 +95,6 @@ See also the item "$undefined" below.
Consider deprecating impure push parsers. They add a lot of complexity, for
a bad feature.
-It's not clear to me that yyerror_range really needs to be in pstate,
-instead of just being a local variable.
-
* Bison 3.7
** Unit rules / Injection rules (Akim Demaille)
Maybe we could expand unit rules (or "injections", see
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index fbfc61ba..0cc2cf1a 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -211,10 +211,7 @@ m4_define([b4_declare_parser_state_variables],
/* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls;
- YYLTYPE *yylsp;
-
- /* The locations where the error started and ended. */
- YYLTYPE yyerror_range[3];]])[]b4_lac_if([[
+ YYLTYPE *yylsp;]])[]b4_lac_if([[
yy_state_t
yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
yy_state_t *yyes;
@@ -264,8 +261,7 @@ $1([yyvs])
$1([yyvsp])[]b4_locations_if([
$1([yylsa])
$1([yyls])
-$1([yylsp])
-$1([yyerror_range])])
+$1([yylsp])])
$1([yystacksize])[]b4_lac_if([
$1([yyesa])
$1([yyes])
@@ -1559,7 +1555,10 @@ yyparse (]m4_ifset([b4_parse_param],
[b4_formals(b4_parse_param)], [void])[)]])[
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;]b4_locations_if([[
- YYLTYPE yyloc;]])[
+ YYLTYPE yyloc;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[3];]])[
]b4_parse_error_bmatch([detailed\|verbose],
[[ /* Buffer for error messages, and its allocated size. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- yacc.c: yyerror_range does not need to be preserved accross calls,
Akim Demaille <=