* 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:27:11 +00:00
parent cd5aafcf8c
commit 6b7e85b994
6 changed files with 26 additions and 9 deletions

View File

@@ -724,7 +724,6 @@ token_buffer);
}
prev = t;
}
}
@@ -852,7 +851,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)
@@ -1724,6 +1723,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"),
@@ -1810,7 +1812,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;