|Switching input buffers in flex email@example.com (Charlie Zender) (2002-05-23)|
|From:||Charlie Zender <firstname.lastname@example.org>|
|Date:||23 May 2002 01:21:09 -0400|
|Organization:||University of California at Irvine|
|Posted-Date:||23 May 2002 01:21:09 EDT|
I'm trying to write a lexer that handles #include files and having
trouble passing control back to the input buffer for the parent file
when the EOF of the #include'd file is reached. According to the
example in the flex manpage, all I need to do is call
but things do not appear to be that simple. Is it true that I must
also make sure that yywrap() returns true (non-zero)? And must I
also manually reconnect yyin to the FILE handle of the parent
file? or is this reconnect handled internally by yy_switch_to_buffer?
Charlie Zender, zender at uci dot edu, (949) 824-2987, Department of
Earth System Science, University of California, Irvine CA 92697-3100
[The yywrap() function is an old kludge, and should always return 1.
The buffer structure keeps track of its input file, so you don't have
to fiddle with yyin. Look at the code in lex.yy.c, which isn't really
very complicated. -John]
Return to the
Search the comp.compilers archives again.