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.
This commit is contained in:
Todd C. Miller
2003-01-06 23:47:04 +00:00
parent 35cf881d76
commit cce84a1811

View File

@@ -339,6 +339,12 @@ PASSWD[[:blank:]]*: {
return(COMMENT); return(COMMENT);
} /* return comments */ } /* return comments */
<GOTRUNAS,GOTDEFS,GOTCMND,STARTDEFS,INDEFS><<EOF>> {
BEGIN INITIAL;
LEXTRACE("EOF ");
return(ERROR);
} /* premature EOF */
<*>. { <*>. {
LEXTRACE("ERROR "); LEXTRACE("ERROR ");
return(ERROR); return(ERROR);