447 |
`----------------------------------------------------------------*/ |
`----------------------------------------------------------------*/ |
448 |
|
|
449 |
symbol_t * |
symbol_t * |
450 |
getsym (const char *key, location_t location) |
symbol_get (const char *key, location_t location) |
451 |
{ |
{ |
452 |
symbol_t probe; |
symbol_t probe; |
453 |
symbol_t *entry; |
symbol_t *entry; |
465 |
} |
} |
466 |
|
|
467 |
|
|
468 |
|
/*------------------------------------------------------------------. |
469 |
|
| Generate a dummy nonterminal, whose name cannot conflict with the | |
470 |
|
| user's names. | |
471 |
|
`------------------------------------------------------------------*/ |
472 |
|
|
473 |
|
symbol_t * |
474 |
|
dummy_symbol_get (location_t location) |
475 |
|
{ |
476 |
|
/* Incremented for each generated symbol. */ |
477 |
|
static int dummy_count = 0; |
478 |
|
static char buf[256]; |
479 |
|
|
480 |
|
symbol_t *sym; |
481 |
|
|
482 |
|
sprintf (buf, "@%d", ++dummy_count); |
483 |
|
sym = symbol_get (buf, location); |
484 |
|
sym->class = nterm_sym; |
485 |
|
sym->number = nvars++; |
486 |
|
return sym; |
487 |
|
} |
488 |
|
|
489 |
|
|
490 |
/*-------------------. |
/*-------------------. |
491 |
| Free the symbols. | |
| Free the symbols. | |
492 |
`-------------------*/ |
`-------------------*/ |