From: Akim Demaille Date: Sun, 7 Apr 2002 17:41:28 +0000 (+0000) Subject: * src/gram.h (rule_t): Rename `number' as `user_number'. X-Git-Tag: BISON-1_49a~70 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/d7e1f00c136e256e51f088ef6f1a11db11fcee72 * src/gram.h (rule_t): Rename `number' as `user_number'. `number' is a new member. Adjust dependencies. * src/reduce.c (reduce_grammar_tables): Renumber rule_t.number. --- diff --git a/ChangeLog b/ChangeLog index 09c3479e..aecf5f91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-04-07 Akim Demaille + + * src/gram.h (rule_t): Rename `number' as `user_number'. + `number' is a new member. + Adjust dependencies. + * src/reduce.c (reduce_grammar_tables): Renumber rule_t.number. + 2002-04-07 Akim Demaille As a result of the previous patch, it is no longer needed diff --git a/src/gram.h b/src/gram.h index 087583ad..024501e3 100644 --- a/src/gram.h +++ b/src/gram.h @@ -1,5 +1,5 @@ /* Data definitions for internal representation of bison's input, - Copyright 1984, 1986, 1989, 1992, 2001, 2002 + Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -118,6 +118,10 @@ typedef struct rule_s { /* The number of the rule in the source. It is usually the index in RULES too, except if there are useless rules. */ + short user_number; + + /* The index in RULES. Usually the rule number in the source, + except if some rules are useless. */ short number; bucket *lhs; diff --git a/src/reader.c b/src/reader.c index 08cf4d45..b09d9f6c 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1687,6 +1687,7 @@ packgram (void) while (p) { bucket *ruleprec = p->ruleprec; + rules[ruleno].user_number = ruleno; rules[ruleno].number = ruleno; rules[ruleno].lhs = p->sym; rules[ruleno].rhs = ritem + itemno; diff --git a/src/reduce.c b/src/reduce.c index 7cdc76ab..45dc1d74 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -255,6 +255,7 @@ reduce_grammar_tables (void) for (/* Nothing. */; *rhsp >= 0; ++rhsp) /* Nothing. */; *rhsp = -i; + rules[i].number = i; } nrules -= nuseless_productions; } @@ -368,7 +369,7 @@ reduce_output (FILE *out) for (i = nrules + 1; i < nuseless_productions + nrules + 1; i++) { rule r; - fprintf (out, "#%-4d ", rules[i].number - 1); + fprintf (out, "#%-4d ", rules[i].user_number - 1); fprintf (out, "%s:", rules[i].lhs->tag); for (r = rules[i].rhs; *r >= 0; r++) fprintf (out, " %s", symbols[*r]->tag);