+2001-12-29 Akim Demaille <akim@epita.fr>
+
+ * 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.
+
+
2001-12-29 Akim Demaille <akim@epita.fr>
* tests/regression.at (Web2c Report): Catch up: the rule 0 is now
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):
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;
}