/* Symbol table manager for Bison.
- Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software
+ Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
static symbol *
symbol_new (uniqstr tag, location loc)
{
- symbol *res = MALLOC (res, 1);
+ symbol *res = xmalloc (sizeof *res);
uniqstr_assert (tag);
res->tag = tag;
res->alias = NULL;
res->class = unknown_sym;
+ if (nsyms == SYMBOL_NUMBER_MAXIMUM)
+ fatal (_("too many symbols in input grammar (limit is %d)"),
+ SYMBOL_NUMBER_MAXIMUM);
nsyms++;
return res;
}
abort ();
sym->number = symval->number =
(symval->number < sym->number) ? symval->number : sym->number;
+ symbol_type_set (symval, sym->type_name, loc);
}
}
if (!(this->alias && this->user_token_number == USER_NUMBER_ALIAS))
return;
- if (orig->type_name || alias->type_name)
+ if (orig->type_name != alias->type_name)
{
if (orig->type_name)
symbol_type_set (alias, orig->type_name, orig->type_location);
symbol probe;
symbol *entry;
- /* Keep the symbol in a printable form. */
- key = uniqstr_new (quotearg_style (escape_quoting_style, key));
+ key = uniqstr_new (key);
probe.tag = key;
entry = hash_lookup (symbol_table, &probe);
max_user_token_number = this->user_token_number;
}
- CALLOC (token_translations, max_user_token_number + 1);
+ token_translations = xnmalloc (max_user_token_number + 1,
+ sizeof *token_translations);
/* Initialize all entries for literal tokens to 2, the internal
token number for $undefined, which represents all invalid inputs.
void
symbols_pack (void)
{
- CALLOC (symbols, nsyms);
+ symbols = xcalloc (nsyms, sizeof *symbols);
symbols_do (symbol_check_alias_consistency_processor, NULL);
symbols_do (symbol_pack_processor, NULL);