* src/symtab.h (SUNDEF): New.

* src/symtab.c (bucket_new): Init user_token_number to SUNDEF to
stand for `uninitialized', instead of 0.
* src/reader.c (packsymbols, parse_thong_decl): Adjust.
* src/lex.c (lex): Adjust.
* tests/calc.at (_AT_DATA_CALC_Y): Declare a token for EOF.
Number it 0.
Let yylex return it instead of a plain 0.
Reported by Dick Streefland.
This commit is contained in:
Akim Demaille
2001-11-02 15:26:33 +00:00
parent ae9b5e5a4f
commit 239e5c1a9a
7 changed files with 29 additions and 9 deletions

View File

@@ -695,7 +695,6 @@ token_buffer);
}
prev = t;
}
}
@@ -821,7 +820,7 @@ parse_thong_decl (void)
token_t token;
struct bucket *symbol;
char *typename = 0;
int usrtoknum = 0;
int usrtoknum = SUNDEF;
token = lex (); /* fetch typename or first token */
if (token == tok_typename)
@@ -1689,6 +1688,9 @@ token_translations_init (void)
/* A token string alias? */
if (bp->user_token_number == SALIAS)
continue;
assert (bp->user_token_number != SUNDEF);
/* A token which translation has already been set? */
if (token_translations[bp->user_token_number] != 2)
complain (_("tokens %s and %s both assigned number %d"),
@@ -1775,7 +1777,7 @@ packsymbols (void)
if (bp->class == token_sym)
{
if (bp->user_token_number == 0)
if (bp->user_token_number == SUNDEF)
bp->user_token_number = ++last_user_token_number;
if (bp->user_token_number > max_user_token_number)
max_user_token_number = bp->user_token_number;