commit 3c340b8114363a3af2fc8690a00bb4909bb63355
parent 991d52591bbb6827a9ebe07daf994426aada724f
Author: sin <sin@2f30.org>
Date: Sun, 11 May 2014 16:35:02 +0100
Guard against unexpected EOF
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/lexer.c b/lexer.c
@@ -229,6 +229,12 @@ again:
tok.e = NULL;
return tok;
}
+ if (state != State_Se) {
+ tok.type = Error;
+ tok.s = "unexpected EOF encountered";
+ tok.e = NULL;
+ return tok;
+ }
tok.type = Eof;
tok.s = "reached the end-of-file";
tok.e = NULL;