Fixed handling of interactive input at EOF

git-svn-id: http://picoc.googlecode.com/svn/trunk@58 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-02-03 00:23:13 +00:00
parent 5b1d4a611f
commit 11fd7f0f16

7
lex.c
View file

@ -215,11 +215,16 @@ enum LexToken LexScanGetToken(struct LexState *Lexer, struct Value **Value)
do
{
if (Lexer->Pos == Lexer->End)
{
{ /* end of input */
if (Lexer->FileName == StrEmpty)
{ /* get interactive input */
char LineBuffer[LINEBUFFER_MAX];
if (fgets(&LineBuffer[0], LINEBUFFER_MAX, stdin) == NULL)
return TokenEOF;
}
else
return TokenEOF;
}
*Value = &LexValue;
while (Lexer->Pos != Lexer->End && isspace(*Lexer->Pos))