/[bison]/bison/src/symtab.c
ViewVC logotype

Diff of /bison/src/symtab.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.30 by akim, Sat Jun 15 18:21:11 2002 UTC revision 1.31 by akim, Sat Jun 15 18:21:46 2002 UTC
# Line 41  location_t startsymbol_location; Line 41  location_t startsymbol_location;
41  `---------------------------------*/  `---------------------------------*/
42    
43  static symbol_t *  static symbol_t *
44  symbol_new (const char *tag)  symbol_new (const char *tag, location_t location)
45  {  {
46    symbol_t *res = XMALLOC (symbol_t, 1);    symbol_t *res = XMALLOC (symbol_t, 1);
47    
48    res->tag = xstrdup (tag);    res->tag = xstrdup (tag);
49    res->type_name = NULL;    res->type_name = NULL;
50      res->location = location;
51    res->number = NUMBER_UNDEFINED;    res->number = NUMBER_UNDEFINED;
52    res->prec = 0;    res->prec = 0;
53    res->assoc = right_assoc;    res->assoc = right_assoc;
# Line 170  symbol_check_defined (symbol_t *this) Line 171  symbol_check_defined (symbol_t *this)
171  {  {
172    if (this->class == unknown_sym)    if (this->class == unknown_sym)
173      {      {
174        complain        complain_at
175          (_("symbol %s is used, but is not defined as a token and has no rules"),          (this->location,
176             _("symbol %s is used, but is not defined as a token and has no rules"),
177           this->tag);           this->tag);
178        this->class = nterm_sym;        this->class = nterm_sym;
179        this->number = nvars++;        this->number = nvars++;
# Line 363  symbols_new (void) Line 365  symbols_new (void)
365  `----------------------------------------------------------------*/  `----------------------------------------------------------------*/
366    
367  symbol_t *  symbol_t *
368  getsym (const char *key)  getsym (const char *key, location_t location)
369  {  {
370    symbol_t probe;    symbol_t probe;
371    symbol_t *entry;    symbol_t *entry;
# Line 374  getsym (const char *key) Line 376  getsym (const char *key)
376    if (!entry)    if (!entry)
377      {      {
378        /* First insertion in the hash. */        /* First insertion in the hash. */
379        entry = symbol_new (key);        entry = symbol_new (key, location);
380        hash_insert (symbol_table, entry);        hash_insert (symbol_table, entry);
381      }      }
382    return entry;    return entry;
# Line 488  symbols_pack (void) Line 490  symbols_pack (void)
490    symbols_token_translations_init ();    symbols_token_translations_init ();
491    
492    if (startsymbol->class == unknown_sym)    if (startsymbol->class == unknown_sym)
493      fatal (_("the start symbol %s is undefined"), startsymbol->tag);      fatal_at (startsymbol_location,
494                  _("the start symbol %s is undefined"), startsymbol->tag);
495    else if (startsymbol->class == token_sym)    else if (startsymbol->class == token_sym)
496      fatal (_("the start symbol %s is a token"), startsymbol->tag);      fatal_at (startsymbol_location,
497                  _("the start symbol %s is a token"), startsymbol->tag);
498  }  }

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26