* src/gram.h, src/gram.c (symbols): New, similar to state_table

and rule_table.
* src/reader.c (packsymbols): Fill this table.
Drop sprec.
* src/conflicts.c (resolve_sr_conflict): Adjust.
* src/reduce.c (reduce_grammar): Adjust: just sort symbols, a
single table.
Use symbols[i]->tag instead of tags[i].
This commit is contained in:
Akim Demaille
2001-12-29 14:18:32 +00:00
parent 213e640e1e
commit 0e78e603f6
7 changed files with 44 additions and 35 deletions

View File

@@ -1556,11 +1556,10 @@ token_translations_init (void)
}
/*------------------------------------------------------------------.
| Assign symbol numbers, and write definition of token names into |
| FDEFINES. Set up vectors TAGS and SPREC of names and precedences |
| of symbols. |
`------------------------------------------------------------------*/
/*----------------------------------------------------------------.
| Assign symbol numbers, and write definition of token names into |
| FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. |
`----------------------------------------------------------------*/
static void
packsymbols (void)
@@ -1571,8 +1570,8 @@ packsymbols (void)
tags = XCALLOC (char *, nsyms + 1);
user_toknums = XCALLOC (short, nsyms + 1);
symbols = XCALLOC (bucket *, nsyms);
sprec = XCALLOC (short, nsyms);
sassoc = XCALLOC (short, nsyms);
max_user_token_number = 256;
@@ -1644,9 +1643,9 @@ packsymbols (void)
max_user_token_number = bp->user_token_number;
}
symbols[bp->value] = bp;
tags[bp->value] = bp->tag;
user_toknums[bp->value] = bp->user_token_number;
sprec[bp->value] = bp->prec;
sassoc[bp->value] = bp->assoc;
}