File: flex.info, Node: EOF, Next: Misc Controls, Prev: Multiple Input Buffers, Up: Top
12 End-of-File Rules
********************
The special rule '<>' indicates actions which are to be taken when
an end-of-file is encountered and 'yywrap()' returns non-zero (i.e.,
indicates no further files to process). The action must finish by doing
one of the following things:
* executing a 'return' statement;
* executing the special 'yyterminate()' action.
* or, switching to a new buffer using 'yy_switch_to_buffer()' as
shown in the example above.
<> rules may not be used with other patterns; they may only be
qualified with a list of start conditions. If an unqualified <>
rule is given, it applies to _all_ start conditions which do not already
have <> actions. To specify an <> rule for only the initial
start condition, use:
<>
These rules are useful for catching things like unclosed comments.
An example:
%x quote
%%
...other rules for dealing with quotes...
<> {
error( "unterminated quote" );
yyterminate();
}
<> {
if ( *++filelist )
yyin = fopen( *filelist, "r" );
else
yyterminate();
}