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:
parent
5b1d4a611f
commit
11fd7f0f16
7
lex.c
7
lex.c
|
@ -215,11 +215,16 @@ enum LexToken LexScanGetToken(struct LexState *Lexer, struct Value **Value)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (Lexer->Pos == Lexer->End)
|
if (Lexer->Pos == Lexer->End)
|
||||||
{
|
{ /* end of input */
|
||||||
|
if (Lexer->FileName == StrEmpty)
|
||||||
|
{ /* get interactive input */
|
||||||
char LineBuffer[LINEBUFFER_MAX];
|
char LineBuffer[LINEBUFFER_MAX];
|
||||||
if (fgets(&LineBuffer[0], LINEBUFFER_MAX, stdin) == NULL)
|
if (fgets(&LineBuffer[0], LINEBUFFER_MAX, stdin) == NULL)
|
||||||
return TokenEOF;
|
return TokenEOF;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return TokenEOF;
|
||||||
|
}
|
||||||
|
|
||||||
*Value = &LexValue;
|
*Value = &LexValue;
|
||||||
while (Lexer->Pos != Lexer->End && isspace(*Lexer->Pos))
|
while (Lexer->Pos != Lexer->End && isspace(*Lexer->Pos))
|
||||||
|
|
Loading…
Reference in a new issue