mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 07:13:02 +00:00
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:
13
src/symtab.h
13
src/symtab.h
@@ -46,10 +46,6 @@ typedef enum
|
||||
|
||||
typedef struct bucket
|
||||
{
|
||||
/* Needed for the hash table. */
|
||||
struct bucket *link;
|
||||
struct bucket *next;
|
||||
|
||||
/* The key, name of the symbol. */
|
||||
char *tag;
|
||||
/* Its type. */
|
||||
@@ -66,12 +62,13 @@ typedef struct bucket
|
||||
symbol_class class;
|
||||
} bucket;
|
||||
|
||||
|
||||
extern bucket *firstsymbol;
|
||||
/* A function to apply to each symbol. */
|
||||
typedef bool (*bucket_processor) PARAMS ((bucket *));
|
||||
|
||||
bucket *getsym PARAMS ((const char *));
|
||||
|
||||
void tabinit PARAMS ((void));
|
||||
void free_symtab PARAMS ((void));
|
||||
void buckets_new PARAMS ((void));
|
||||
void buckets_do PARAMS ((bucket_processor processor, void *processor_data));
|
||||
void buckets_free PARAMS ((void));
|
||||
|
||||
#endif /* !SYMTAB_H_ */
|
||||
|
||||
Reference in New Issue
Block a user