* 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:03:46 +00:00
parent 5c2a5a8970
commit 705131d1de
4 changed files with 52 additions and 3 deletions

View File

@@ -35,11 +35,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)
@@ -324,6 +323,7 @@ void
unlex (token_t token)
{
unlexed = token;
unlexed_token_buffer = token_buffer;
unlexed_symval = symval;
}
@@ -368,6 +368,7 @@ lex (void)
{
token_t res = unlexed;
symval = unlexed_symval;
token_buffer = unlexed_token_buffer;
unlexed = tok_undef;
return res;
}