Next: Options for Scanner Speed and Size, Previous: Options Affecting Scanner Behavior, Up: Scanner Options
%option ansi-definitions’%option noansi-definitions is specified, then the obsolete style
is generated.
     %option ansi-prototypes’noansi-prototypes is specified, then
prototypes will have empty parameter lists.
     %option bison-bridge’GNU bison
parser. The scanner has minor API changes for
bison
compatibility. In particular, the declaration of
yylex
is modified to take an additional parameter,
yylval. 
See Bison Bridge.
     %option bison-locations’GNU bison %locations are being used. 
This means yylex will be passed
an additional parameter, yylloc. This option
implies %option bison-bridge. 
See Bison Bridge.
     %option noline’flex
not to generate
#line
directives.  Without this option,
flex
peppers the generated scanner
with #line directives so error messages in the actions will be correctly
located with respect to either the original
flex
input file (if the errors are due to code in the input file), or
lex.yy.c
(if the errors are
flex's
fault – you should report these sorts of errors to the email address
given in Reporting Bugs).
     %option 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.
%option c++’%option array’%option pointer’yytext should be a char *, not an array. 
This default is char *.
     %option prefix="PREFIX"’flex for all
globally-visible variable and function names to instead be
‘PREFIX’.  For example, ‘--prefix=foo’ changes the name of
yytext to 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 yywrap and
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
flex
programs into the same executable.  Note, though, that using this
option also renames
yywrap(),
so you now
must
either
provide your own (appropriately-named) version of the routine for your
scanner, or use
%option noyywrap,
as linking with
‘-lfl’
no longer provides one for you by default.
     
%option main’main() program for the
scanner, which simply calls yylex().  This option implies
noyywrap (see below).
     %option nounistd’isatty(), read().) 
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.
     %option yyclass="NAME"’flex that you have derived NAME as a subclass of
yyFlexLexer, so flex will place your actions in the member
function foo::yylex() instead of yyFlexLexer::yylex().  It
also generates a yyFlexLexer::yylex() member function that emits
a run-time error (by invoking yyFlexLexer::LexerError()) if
called.  See Cxx.