mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +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/c.m4
18
data/c.m4
@@ -396,23 +396,27 @@ m4_define([b4_yysymprint_generate],
|
||||
(void) yyvaluep;
|
||||
b4_location_if([ (void) yylocationp;
|
||||
])dnl
|
||||
|
||||
[
|
||||
if (yytype < YYNTOKENS)
|
||||
{
|
||||
YYFPRINTF (yyoutput, "token %s (", yytname[[yytype]]);
|
||||
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||||
# ifdef YYPRINT
|
||||
YYPRINT (yyoutput, yytoknum[[yytype]], *yyvaluep);
|
||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||
# endif
|
||||
}
|
||||
else
|
||||
YYFPRINTF (yyoutput, "nterm %s (", yytname[[yytype]]);
|
||||
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||
|
||||
]b4_location_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||
fprintf (yyoutput, ": ");
|
||||
])dnl
|
||||
[
|
||||
switch (yytype)
|
||||
{
|
||||
m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||
default:
|
||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||
[ default:
|
||||
break;
|
||||
}
|
||||
YYFPRINTF (yyoutput, ")");
|
||||
}
|
||||
])
|
||||
]])
|
||||
|
||||
Reference in New Issue
Block a user