|
Noeud:Flex Directives, Noeud «Next»:Flex Regular Expressions, Noeud «Up»:Using Flex
Flex supports several directives, only a few of them being presented below, see (FIXME: cite Flex documentation.), for more information. Most of them have command line option equivalent, but in typical uses it is better to embed them within the file.
%option debug
yy_flex_debug
, which, when set to a non zero value, triggers
tracing messages on the standard error output.
You are encouraged to use this option, in particular when developing
your scanner, and to have some option to set yy_flex_debug
. In
particular, never write printf
-like tracing code in your scanner:
that's an absolute waste of time.
%option nodefault
%option nounput
%option noyywrap
unput
and/or yywrap
.
These two functions are beyond the scope of this book and won't be
detailed. Nevertheless we present these options so that (i) we no
longer need the Flex library (which provides a default yywrap
),
and (ii) our scanners compile without triggering warning:
`yyunput' defined but not used
.
%option outfile="file"
%option prefix="prefix"
yy
prefix with prefix. It also
changes the default output file from lex.yy.c
to
lex.prefix.c
.