Use lib/hash for the symbol table.

* src/gram.c (ntokens): Initialize to 1, to reserve a slot for
EOF.
* src/lex.c (lex): Set the `number' member of new terminals.
* src/reader.c (bucket_check_defined, bucket_make_alias)
(bucket_check_alias_consistence, bucket_translation): New.
(reader, grammar_free, readgram, token_translations_init)
(packsymbols): Adjust.
(reader): Number the predefined tokens.
* src/reduce.c (inaccessable_symbols): Just use hard coded numbers
for predefined tokens.
* src/symtab.h (bucket): Remove all the hash table related
members.
* src/symtab.c (symtab): Replace by...
(bucket_table): this.
(bucket_new, bucket_free, hash_compare_bucket, hash_bucket)
(buckets_new, buckets_do): New.
This commit is contained in:
Akim Demaille
2002-04-07 17:43:21 +00:00
parent 280a38c306
commit 72a23c9797
7 changed files with 360 additions and 232 deletions

View File

@@ -199,9 +199,9 @@ inaccessable_symbols (void)
V = Vp;
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
bitset_set (V, 0); /* end-of-input token */
bitset_set (V, 1); /* error token */
bitset_set (V, 2); /* some undefined token */
bitset_set (V, eoftoken->number); /* end-of-input token */
bitset_set (V, errtoken->number); /* error token */
bitset_set (V, undeftoken->number); /* some undefined token */
bitset_free (P);
P = Pp;