In stream_get(), EOF never got it to stream->buffer and because of
this, stream_unget() failed on some situations. This patch makes
stream_get() handle EOF just like any other byte.
As a "side effect", lex_scan_string() now needs to unget the EOF, or
otherwise it ends up in error message on premature end of input.
c = stream->buffer[0];
- if(c == EOF && stream->eof(stream->data))
- return EOF;
-
- if(c < 0)
+ if(c < 0 && c != EOF)
{
/* multi-byte UTF-8 sequence */
int i, count;
lex->value.string = NULL;
lex->token = TOKEN_INVALID;
- /* skip the " */
c = lex_get_save(lex, error);
while(c != '"') {
if(c == EOF) {
+ lex_unget_unsave(lex, c);
if(lex_eof(lex))
error_set(error, lex, "premature end of input");
goto out;