instructs flex to generate a C scanner that is
meant to be called by a
parser. The scanner has minor API changes for
compatibility. In particular, the declaration of
is modified to take an additional parameter,
See Bison Bridge.
instruct flex that
%locations are being used.
yylex will be passed
an additional parameter,
yylloc. This option
See Bison Bridge.
not to generate
directives. Without this option,
peppers the generated scanner
#line directives so error messages in the actions will be correctly
located with respect to either the original
input file (if the errors are due to code in the input file), or
(if the errors are
fault – you should report these sorts of errors to the email address
given in Reporting Bugs).
instructs flex to generate a reentrant C scanner. The generated scanner
may safely be used in a multi-threaded environment. The API for a
reentrant scanner is different than for a non-reentrant scanner
see Reentrant). Because of the API difference between
reentrant and non-reentrant
flex scanners, non-reentrant flex
code must be modified before it is suitable for use with this option.
This option is not compatible with the ‘--c++’ option.
The option ‘--reentrant’ does not affect the performance of the scanner.
specifies that you want flex to generate a C++ scanner class. See Cxx, for details.
specifies that you want yytext to be an array instead of a char*
yytext should be a
char *, not an array.
This default is
changes the default ‘yy’ prefix used by
flex for all
globally-visible variable and function names to instead be
‘PREFIX’. For example, ‘--prefix=foo’ changes the name of
footext. It also changes the name of the default
output file from lex.yy.c to lex.foo.c. Here is a partial
list of the names affected:
yy_create_buffer yy_delete_buffer yy_flex_debug yy_init_buffer yy_flush_buffer yy_load_buffer_state yy_switch_to_buffer yyin yyleng yylex yylineno yyout yyrestart yytext yywrap yyalloc yyrealloc yyfree
(If you are using a C++ scanner, then only
yyFlexLexer are affected.) Within your scanner itself, you can
still refer to the global variables and functions using either version
of their name; but externally, they have the modified name.
This option lets you easily link together multiple
programs into the same executable. Note, though, that using this
option also renames
so you now
provide your own (appropriately-named) version of the routine for your
scanner, or use
as linking with
no longer provides one for you by default.
directs flex to provide a default
main() program for the
scanner, which simply calls
yylex(). This option implies
noyywrap (see below).
suppresses inclusion of the non-ANSI header file unistd.h. This option
is meant to target environments in which unistd.h does not exist. Be aware
that certain options may cause flex to generate code that relies on functions
normally found in unistd.h, (e.g.
If you wish to use these functions, you will have to inform your compiler where
to find them.
See option-always-interactive. See option-read.
only applies when generating a C++ scanner (the ‘--c++’ option). It
flex that you have derived
NAME as a subclass of
flex will place your actions in the member
foo::yylex() instead of
also generates a
yyFlexLexer::yylex() member function that emits
a run-time error (by invoking
called. See Cxx.