bison-patches
[Top][All Lists]
Advanced

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

09-fyi-sanity-then-enrich.patch


From: Akim Demaille
Subject: 09-fyi-sanity-then-enrich.patch
Date: Sat, 29 Dec 2001 15:13:57 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * src/reader.c (readgram): Don't add the rule 0 if there were no
        rules read.  In other words, add it _after_ having performed
        grammar sanity checks.
        Fixes the `tests/regression.at (Invalid input: 1)' Failure.
        
        
Index: src/reader.c
--- src/reader.c Fri, 28 Dec 2001 15:22:21 +0100 akim
+++ src/reader.c Fri, 28 Dec 2001 15:29:34 +0100 akim
@@ -1451,6 +1451,23 @@
        t = lex ();
       }
 
+  /* grammar has been read.  Do some checking */
+
+  if (nrules == 0)
+    fatal (_("no rules in the input grammar"));
+
+  /* Report any undefined symbols and consider them nonterminals.  */
+
+  for (bp = firstsymbol; bp; bp = bp->next)
+    if (bp->class == unknown_sym)
+      {
+       complain (_
+                 ("symbol %s is used, but is not defined as a token and has no 
rules"),
+                 bp->tag);
+       bp->class = nterm_sym;
+       bp->value = nvars++;
+      }
+
   /* Insert the initial rule, which line is that of the first rule
      (not that of the start symbol):
 
@@ -1466,25 +1483,9 @@
   grammar = p;
   startval = axiom;
 
-  /* grammar has been read.  Do some checking */
-
   if (nsyms > MAXSHORT)
     fatal (_("too many symbols (tokens plus nonterminals); maximum %d"),
           MAXSHORT);
-  if (nrules == 0)
-    fatal (_("no rules in the input grammar"));
-
-  /* Report any undefined symbols and consider them nonterminals.  */
-
-  for (bp = firstsymbol; bp; bp = bp->next)
-    if (bp->class == unknown_sym)
-      {
-       complain (_
-                 ("symbol %s is used, but is not defined as a token and has no 
rules"),
-                 bp->tag);
-       bp->class = nterm_sym;
-       bp->value = nvars++;
-      }
 
   ntokens = nsyms - nvars;
 }



reply via email to

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