[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
end of file on Mac OS X
From: |
Steven Eker |
Subject: |
end of file on Mac OS X |
Date: |
Sat, 01 Feb 2014 19:31:19 -0800 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
I've noticed that yyinput()/input() returns 0 rather than EOF when it
hits the end of the file. On Linux the expected EOF is returned.
Mac OS X:
ape:Mixfix eker$ flex --version
flex 2.5.35 Apple(flex-31)
Linux:
psi:Mixfix > flex --version
flex 2.5.35
If I examine the C/C++ code generated, there is indeed a difference at
the relevant line in yyinput()/input():
Mac:
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return 0;
if ( !
(yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
Linux:
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return EOF;
if ( !
(yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
So is this a bug (in the Mac version) or is this weirdness documented
somewhere?
Steven Eker
http://www.csl.sri.com/people/eker/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- end of file on Mac OS X,
Steven Eker <=