mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
* src/reader.c (gensym): Rename as...
* src/symtab.h, src/symtab.c (dummy_symbol_get): this. (getsym): Rename as... (symbol_get): this.
This commit is contained in:
24
src/symtab.c
24
src/symtab.c
@@ -447,7 +447,7 @@ symbols_new (void)
|
||||
`----------------------------------------------------------------*/
|
||||
|
||||
symbol_t *
|
||||
getsym (const char *key, location_t location)
|
||||
symbol_get (const char *key, location_t location)
|
||||
{
|
||||
symbol_t probe;
|
||||
symbol_t *entry;
|
||||
@@ -465,6 +465,28 @@ getsym (const char *key, location_t location)
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Generate a dummy nonterminal, whose name cannot conflict with the |
|
||||
| user's names. |
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
symbol_t *
|
||||
dummy_symbol_get (location_t location)
|
||||
{
|
||||
/* Incremented for each generated symbol. */
|
||||
static int dummy_count = 0;
|
||||
static char buf[256];
|
||||
|
||||
symbol_t *sym;
|
||||
|
||||
sprintf (buf, "@%d", ++dummy_count);
|
||||
sym = symbol_get (buf, location);
|
||||
sym->class = nterm_sym;
|
||||
sym->number = nvars++;
|
||||
return sym;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------.
|
||||
| Free the symbols. |
|
||||
`-------------------*/
|
||||
|
||||
Reference in New Issue
Block a user