diff --git a/Makefile b/Makefile index db40e4f..62647e1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wall -g +CFLAGS=-Wall -g -DDEBUG_HEAP LIBS=-lm TARGET = picoc diff --git a/lex.c b/lex.c index 57edf72..af8fc20 100644 --- a/lex.c +++ b/lex.c @@ -214,18 +214,6 @@ 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)) { @@ -235,6 +223,20 @@ enum LexToken LexScanGetToken(struct LexState *Lexer, struct Value **Value) Lexer->Pos++; } + 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; + + // XXX - finish this + } + else + return TokenEOF; + } + ThisChar = *Lexer->Pos; if (isCidstart(ThisChar)) return LexGetWord(Lexer, *Value);