|What happens at the end of the file for lex? firstname.lastname@example.org (Philipp Klaus Krause) (2020-06-03)|
|Re: What happens at the end of the file for lex? email@example.com (Philipp Klaus Krause) (2020-06-04)|
|From:||Philipp Klaus Krause <firstname.lastname@example.org>|
|Date:||Thu, 4 Jun 2020 19:16:09 +0200|
|Injection-Info:||gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="81737"; mail-complaints-to="email@example.com"|
|Posted-Date:||04 Jun 2020 20:45:51 EDT|
Further investigation shows that this was an intentional, but
undocumented change in flex in 2015 (flex 2.5.4 input() returns EOF at
the end of the file, flex 2.6.4 input() returns 0). However I still have
no idea why this change was made.
I guess the only portable way to handle the end of the file is to set a
flag in yywrap() and check it each time input() was called.
[Returning EOF was a bug. The lex input() always returned 0 at end of file. -John]
Return to the
Search the comp.compilers archives again.