bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

d: obey parse.error


From: Akim Demaille
Subject: d: obey parse.error
Date: Sat, 7 Dec 2019 10:57:53 +0100

Diff -w to be more readable, but indentation was fixed.


commit 7c024ef811755767905b4936129e2a78e245335c
Author: Akim Demaille <address@hidden>
Date:   Sat Dec 7 10:09:24 2019 +0100

    d: obey parse.error
    
    * data/skeletons/lalr1.d (yysyntax_error): Let the dispatch be
    bison-time, not runtime.

diff --git a/TODO b/TODO
index ae3a6c96..4ca72790 100644
--- a/TODO
+++ b/TODO
@@ -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
diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d
index 22f4899f..5aa2fb6e 100644
--- a/data/skeletons/lalr1.d
+++ b/data/skeletons/lalr1.d
@@ -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";
   }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]