From cce84a181144de6b39b9deec26862f9dba305dd0 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 6 Jan 2003 23:47:04 +0000 Subject: [PATCH] Work around what appears to be a flex bug when dealing with files that lack a final newline before EOF. This adds a rule to match EOF in the non-initial states which resets the state to INITIAL and throws an error. --- parse.lex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parse.lex b/parse.lex index 0ce1dc5c2..0f997d8d8 100644 --- a/parse.lex +++ b/parse.lex @@ -339,6 +339,12 @@ PASSWD[[:blank:]]*: { return(COMMENT); } /* return comments */ +<> { + BEGIN INITIAL; + LEXTRACE("EOF "); + return(ERROR); + } /* premature EOF */ + <*>. { LEXTRACE("ERROR "); return(ERROR); -- 2.40.0