* tests/regression.at (Invalid input: 2): New.

* src/lex.c (unlexed_token_buffer): New.
(lex, unlex): Adjust: when unlexing, be sure to save token_buffer
too.
Reported by Wwp.
This commit is contained in:
Akim Demaille
2001-11-01 18:05:22 +00:00
parent f987e9d257
commit 561f9a30af
4 changed files with 52 additions and 3 deletions

View File

@@ -36,11 +36,10 @@ const char *token_buffer = NULL;
bucket *symval;
int numval;
/* these two describe a token to be reread */
/* A token to be reread, see unlex and lex. */
static token_t unlexed = tok_undef;
/* by the next call to lex */
static bucket *unlexed_symval = NULL;
static const char *unlexed_token_buffer = NULL;
void
lex_init (void)
@@ -325,6 +324,7 @@ void
unlex (token_t token)
{
unlexed = token;
unlexed_token_buffer = token_buffer;
unlexed_symval = symval;
}
@@ -369,6 +369,7 @@ lex (void)
{
token_t res = unlexed;
symval = unlexed_symval;
token_buffer = unlexed_token_buffer;
unlexed = tok_undef;
return res;
}