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/


_______________________________________________
help-flex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-flex

Reply via email to