Re: What happens at the end of the file for lex?

Philipp Klaus Krause <pkk@spth.de>
Thu, 4 Jun 2020 19:16:09 +0200

          From comp.compilers

Related articles
What happens at the end of the file for lex? pkk@spth.de (Philipp Klaus Krause) (2020-06-03)
Re: What happens at the end of the file for lex? pkk@spth.de (Philipp Klaus Krause) (2020-06-04)
| List of all articles for this month |
From: Philipp Klaus Krause <pkk@spth.de>
Newsgroups: comp.compilers
Date: Thu, 4 Jun 2020 19:16:09 +0200
Organization: solani.org
References: 20-06-001
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="81737"; mail-complaints-to="abuse@iecc.com"
Keywords: flex
Posted-Date: 04 Jun 2020 20:45:51 EDT
Content-Language: en-US

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.


Philipp
[Returning EOF was a bug. The lex input() always returned 0 at end of file. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.