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

* src/lex.c (lex): Be sure to set `token_buffer' in any case.
Reported by Shura.
This commit is contained in:
Akim Demaille
2001-10-02 15:52:24 +00:00
parent d8b1af2801
commit f1394282f0
3 changed files with 39 additions and 2 deletions

View File

@@ -469,32 +469,40 @@ lex (void)
}
case ',':
token_buffer = ",";
return tok_comma;
case ':':
token_buffer = ":";
return tok_colon;
case ';':
token_buffer = ";";
return tok_semicolon;
case '|':
token_buffer = "|";
return tok_bar;
case '{':
token_buffer = "{";
return tok_left_curly;
case '=':
obstack_1grow (&token_obstack, c);
do
{
c = getc (finput);
obstack_1grow (&token_obstack, c);
if (c == '\n')
lineno++;
}
while (c == ' ' || c == '\n' || c == '\t');
obstack_1grow (&token_obstack, '\0');
token_buffer = obstack_finish (&token_obstack);
if (c == '{')
{
token_buffer = "={";
return tok_left_curly;
}
else
@@ -511,6 +519,9 @@ lex (void)
return parse_percent_token ();
default:
obstack_1grow (&token_obstack, c);
obstack_1grow (&token_obstack, '\0');
token_buffer = obstack_finish (&token_obstack);
return tok_illegal;
}
}