d: obey parse.error

* data/skeletons/lalr1.d (yysyntax_error): Let the dispatch be
bison-time, not runtime.
This commit is contained in:
Akim Demaille
2019-12-07 10:09:24 +01:00
parent 9bf06f6963
commit 046f238826
2 changed files with 67 additions and 77 deletions

4
TODO
View File

@@ -2,10 +2,6 @@
** Deprecate YYPRINT
The doc shows it too much.
** java, d: error.verbose
The code checks dynamically for error.verbose. It should be controlled by
M4.
** doc
I feel its ugly to use the GNU style to declare functions in the doc. It
generates tons of white space in the page, and may contribute to bad page

View File

@@ -187,9 +187,6 @@ b4_user_union_members
{
]b4_identification[
/** True if verbose error messages are enabled. */
public bool errorVerbose = ]b4_flag_value([error_verbose])[;
]b4_locations_if([[
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
{
@@ -400,7 +397,8 @@ b4_user_union_members
ref ]b4_yystype[ yyvaluep]dnl
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
{
if (0 < yydebug) {
if (0 < yydebug)
{
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
~ yytname_[yytype] ~ " ("]b4_locations_if([
~ yylocationp.toString() ~ ": "])[;
@@ -667,9 +665,7 @@ m4_popdef([b4_at_dollar])])dnl
// Generate an error message.
private final string yysyntax_error (int yystate, int tok)
{
if (errorVerbose)
{
{]b4_error_verbose_if([[
/* There are many possibilities here to consider:
- Assume YYFAIL is not used. It's too flawed to consider.
See
@@ -736,9 +732,7 @@ m4_popdef([b4_at_dollar])])dnl
}
}
return res;
}
}
}]])[
return "syntax error";
}