Skip to content

Commit 9cc76ee

Browse files
committed
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.
1 parent 2f83ef5 commit 9cc76ee

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

TODO

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ See also the item "$undefined" below.
9595
Consider deprecating impure push parsers. They add a lot of complexity, for
9696
a bad feature.
9797

98-
It's not clear to me that yyerror_range really needs to be in pstate,
99-
instead of just being a local variable.
100-
10198
* Bison 3.7
10299
** Unit rules / Injection rules (Akim Demaille)
103100
Maybe we could expand unit rules (or "injections", see

data/skeletons/yacc.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,7 @@ m4_define([b4_declare_parser_state_variables],
211211
/* The location stack. */
212212
YYLTYPE yylsa[YYINITDEPTH];
213213
YYLTYPE *yyls;
214-
YYLTYPE *yylsp;
215-
216-
/* The locations where the error started and ended. */
217-
YYLTYPE yyerror_range[3];]])[]b4_lac_if([[
214+
YYLTYPE *yylsp;]])[]b4_lac_if([[
218215

219216
yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
220217
yy_state_t *yyes;
@@ -264,8 +261,7 @@ m4_define([b4_parse_state_variable_macros],
264261
$1([yyvsp])[]b4_locations_if([
265262
$1([yylsa])
266263
$1([yyls])
267-
$1([yylsp])
268-
$1([yyerror_range])])
264+
$1([yylsp])])
269265
$1([yystacksize])[]b4_lac_if([
270266
$1([yyesa])
271267
$1([yyes])
@@ -1559,7 +1555,10 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
15591555
/* The variables used to return semantic value and location from the
15601556
action routines. */
15611557
YYSTYPE yyval;]b4_locations_if([[
1562-
YYLTYPE yyloc;]])[
1558+
YYLTYPE yyloc;
1559+
1560+
/* The locations where the error started and ended. */
1561+
YYLTYPE yyerror_range[3];]])[
15631562

15641563
]b4_parse_error_bmatch([detailed\|verbose],
15651564
[[ /* Buffer for error messages, and its allocated size. */

0 commit comments

Comments
 (0)