mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
* data/yacc.c (YY_LOCATION_PRINT): New.
Define when we know YYLTYPE's structure, i.e., when the default YYLLOC_DEFAULT is used. * data/c.m4 (b4_yysymprint_generate): Use it. * data/lalr1.cc (YYLLOC_DEFAULT): Stop relying on the initial value of the result. (error_start_): Replace with... (error_range_): this location array. This allows to replace code relying on the implementation of locations by portable code. * data/yacc.c (yylerrsp): Replace with... (yyerror_range): this. Every time a token is popped, update yyerror_range[0], to have an accurate location for the error token. * data/glr.c (YY_LOCATION_PRINT): New. (yyprocessOneStack): Fix an invocation of YY_SYMBOL_PRINT: deference a pointer. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): No longer report the location in %printers. * src/scan-skel.l: Instead of abort, report error messages to ease understanding skeleton scanning failures.
This commit is contained in:
18
data/glr.c
18
data/glr.c
@@ -420,8 +420,7 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
||||
/* Error token number */
|
||||
#define YYTERROR 1
|
||||
|
||||
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
|
||||
are run). */
|
||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. */
|
||||
|
||||
]b4_location_if([[
|
||||
#define YYRHSLOC(yyRhs,YYK) ((yyRhs)[YYK].yystate.yyloc)
|
||||
@@ -432,6 +431,15 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
||||
(yyCurrent).first_column = YYRHSLOC(yyRhs, 1).first_column, \
|
||||
(yyCurrent).last_line = YYRHSLOC(yyRhs, YYN).last_line, \
|
||||
(yyCurrent).last_column = YYRHSLOC(yyRhs, YYN).last_column)
|
||||
|
||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||
This macro was not mandated originally: define only if we know
|
||||
we won't break user code: when these are the locations we know. */
|
||||
|
||||
# define YY_LOCATION_PRINT(File, Loc) \
|
||||
fprintf (File, "%d.%d-%d.%d", \
|
||||
(Loc).first_line, (Loc).first_column, \
|
||||
(Loc).last_line, (Loc).last_column)
|
||||
#endif
|
||||
]],[
|
||||
#ifndef YYLLOC_DEFAULT
|
||||
@@ -439,6 +447,10 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
||||
#endif
|
||||
])[
|
||||
|
||||
#ifndef YY_LOCATION_PRINT
|
||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||
#endif
|
||||
|
||||
|
||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
||||
@@ -1579,7 +1591,7 @@ yyprocessOneStack (yyGLRStack* yystack, int yyk,
|
||||
if (yyisShiftAction (yyaction))
|
||||
{
|
||||
YYDPRINTF ((stderr, "On stack %d, ", yyk));
|
||||
YY_SYMBOL_PRINT ("shifting", yytokenp, yylvalp, yyllocp);
|
||||
YY_SYMBOL_PRINT ("shifting", *yytokenp, yylvalp, yyllocp);
|
||||
yyglrShift (yystack, yyk, yyaction, yyposn+1,
|
||||
*yylvalp, yyllocp]b4_user_args[);
|
||||
YYDPRINTF ((stderr, ", now in state #%d\n",
|
||||
|
||||
Reference in New Issue
Block a user