bucket.value as bucket.number.
+2002-04-07 Akim Demaille <akim@epita.fr>
+
+ * src/output.c, src/reader.c, src/symtab.c, src/symtab.h: Rename
+ bucket.value as bucket.number.
+
+
2002-04-07 Akim Demaille <akim@epita.fr>
* src/closure.c, src/derives.c, src/gram.h, src/lalr.c,
2002-04-07 Akim Demaille <akim@epita.fr>
* src/closure.c, src/derives.c, src/gram.h, src/lalr.c,
if (number == SALIAS)
continue;
/* Skip error token. */
if (number == SALIAS)
continue;
/* Skip error token. */
- if (symbol->value == error_token_number)
+ if (symbol->number == error_token_number)
continue;
if (symbol->tag[0] == '\'')
continue; /* skip literal character */
continue;
if (symbol->tag[0] == '\'')
continue; /* skip literal character */
if (semantic_parser)
/* FIXME: This is probably wrong, and should be just as
above. --akim. */
if (semantic_parser)
/* FIXME: This is probably wrong, and should be just as
above. --akim. */
- fprintf (out, "# define T%s\t%d\n", symbol->tag, symbol->value);
+ fprintf (out, "# define T%s\t%d\n", symbol->tag, symbol->number);
complain (_("symbol %s redefined"), symbol->tag);
symbol->class = what_is;
if (what_is == nterm_sym && oldclass != nterm_sym)
complain (_("symbol %s redefined"), symbol->tag);
symbol->class = what_is;
if (what_is == nterm_sym && oldclass != nterm_sym)
- symbol->value = nvars++;
+ symbol->number = nvars++;
token_buffer = buf;
sym = getsym (token_buffer);
sym->class = nterm_sym;
token_buffer = buf;
sym = getsym (token_buffer);
sym->class = nterm_sym;
if (lhs->class == unknown_sym)
{
lhs->class = nterm_sym;
if (lhs->class == unknown_sym)
{
lhs->class = nterm_sym;
nvars++;
}
else if (lhs->class == token_sym)
nvars++;
}
else if (lhs->class == token_sym)
("symbol %s is used, but is not defined as a token and has no rules"),
bp->tag);
bp->class = nterm_sym;
("symbol %s is used, but is not defined as a token and has no rules"),
bp->tag);
bp->class = nterm_sym;
}
/* Insert the initial rule, which line is that of the first rule
}
/* Insert the initial rule, which line is that of the first rule
for (bp = firstsymbol; bp; bp = bp->next)
{
/* Non-terminal? */
for (bp = firstsymbol; bp; bp = bp->next)
{
/* Non-terminal? */
- if (bp->value >= ntokens)
+ if (bp->number >= ntokens)
continue;
/* A token string alias? */
if (bp->user_token_number == SALIAS)
continue;
/* A token string alias? */
if (bp->user_token_number == SALIAS)
complain (_("tokens %s and %s both assigned number %d"),
symbols[token_translations[bp->user_token_number]]->tag,
bp->tag, bp->user_token_number);
complain (_("tokens %s and %s both assigned number %d"),
symbols[token_translations[bp->user_token_number]]->tag,
bp->tag, bp->user_token_number);
- token_translations[bp->user_token_number] = bp->value;
+ token_translations[bp->user_token_number] = bp->number;
{
if (bp->class == nterm_sym)
{
{
if (bp->class == nterm_sym)
{
}
else if (bp->alias)
{
/* This symbol and its alias are a single token defn.
Allocate a tokno, and assign to both check agreement of
prec and assoc fields and make both the same */
}
else if (bp->alias)
{
/* This symbol and its alias are a single token defn.
Allocate a tokno, and assign to both check agreement of
prec and assoc fields and make both the same */
{
if (bp == eoftoken || bp->alias == eoftoken)
{
if (bp == eoftoken || bp->alias == eoftoken)
- bp->value = bp->alias->value = 0;
+ bp->number = bp->alias->number = 0;
- bp->value = bp->alias->value = tokno++;
+ bp->number = bp->alias->number = tokno++;
else /* bp->class == token_sym */
{
if (bp == eoftoken)
else /* bp->class == token_sym */
{
if (bp == eoftoken)
}
if (bp->class == token_sym)
}
if (bp->class == token_sym)
max_user_token_number = bp->user_token_number;
}
max_user_token_number = bp->user_token_number;
}
- symbols[bp->value] = bp;
+ symbols[bp->number] = bp;
}
token_translations_init ();
}
token_translations_init ();
- error_token_number = errtoken->value;
+ error_token_number = errtoken->number;
if (startval->class == unknown_sym)
fatal (_("the start symbol %s is undefined"), startval->tag);
else if (startval->class == token_sym)
fatal (_("the start symbol %s is a token"), startval->tag);
if (startval->class == unknown_sym)
fatal (_("the start symbol %s is undefined"), startval->tag);
else if (startval->class == token_sym)
fatal (_("the start symbol %s is a token"), startval->tag);
- start_symbol = startval->value;
+ start_symbol = startval->number;
}
/*---------------------------------------------------------------.
| Convert the rules into the representation using RRHS, RLHS and |
}
/*---------------------------------------------------------------.
| Convert the rules into the representation using RRHS, RLHS and |
`---------------------------------------------------------------*/
static void
`---------------------------------------------------------------*/
static void
while (p)
{
bucket *ruleprec = p->ruleprec;
while (p)
{
bucket *ruleprec = p->ruleprec;
- rules[ruleno].lhs = p->sym->value;
+ rules[ruleno].lhs = p->sym->number;
rules[ruleno].rhs = ritem + itemno;
rules[ruleno].line = p->line;
rules[ruleno].useful = TRUE;
rules[ruleno].rhs = ritem + itemno;
rules[ruleno].line = p->line;
rules[ruleno].useful = TRUE;
p = p->next;
while (p && p->sym)
{
p = p->next;
while (p && p->sym)
{
- ritem[itemno++] = p->sym->value;
+ ritem[itemno++] = p->sym->number;
/* A rule gets by default the precedence and associativity
of the last token in it. */
if (p->sym->class == token_sym)
/* A rule gets by default the precedence and associativity
of the last token in it. */
if (p->sym->class == token_sym)
{
rules[ruleno].prec = ruleprec->prec;
rules[ruleno].assoc = ruleprec->assoc;
{
rules[ruleno].prec = ruleprec->prec;
rules[ruleno].assoc = ruleprec->assoc;
- rules[ruleno].precsym = ruleprec->value;
+ rules[ruleno].precsym = ruleprec->number;
}
ritem[itemno++] = -ruleno;
}
ritem[itemno++] = -ruleno;
/* Construct the axiom symbol. */
axiom = getsym ("$axiom");
axiom->class = nterm_sym;
/* Construct the axiom symbol. */
axiom = getsym ("$axiom");
axiom->class = nterm_sym;
- axiom->value = nvars++;
+ axiom->number = nvars++;
/* Construct the error token */
errtoken = getsym ("error");
/* Construct the error token */
errtoken = getsym ("error");
/* Symbol table manager for Bison,
/* Symbol table manager for Bison,
- Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This file is part of Bison, the GNU Compiler Compiler.
res->next = NULL;
res->tag = xstrdup (tag);
res->type_name = NULL;
res->next = NULL;
res->tag = xstrdup (tag);
res->type_name = NULL;
res->prec = 0;
res->assoc = right_assoc;
res->user_token_number = SUNDEF;
res->prec = 0;
res->assoc = right_assoc;
res->user_token_number = SUNDEF;
char *tag;
/* Its type. */
char *type_name;
char *tag;
/* Its type. */
char *type_name;
short prec;
associativity assoc;
short user_token_number;
short prec;
associativity assoc;
short user_token_number;