mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 12:53:03 +00:00
* 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.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
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
|
||||
|
||||
33
src/reader.c
33
src/reader.c
@@ -1451,6 +1451,23 @@ readgram (void)
|
||||
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 @@ readgram (void)
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user