Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
User Commands (d - f)
flex(1)
NAME
flex - Generates a C language lexical analyzer
SYNOPSIS
flex [-bcdfinpstvFILT8] -C[efmF][-Sskeleton][file ...]
FLAGS
-b Generates backtracking information to file lex.backtrack. This is a list of scanner states
that require backtracking and the input characters on which they backtrack. By adding
rules, you can remove backtracking states. If all backtracking states are eliminated and
the -f or -F flag is used, the generated scanner will run faster.
-d Makes the generated scanner run in debug mode. Whenever a pattern is recognized and
the global yy_lex_debug is nonzero (which is the default value), the scanner writes to
the standard error file a line of the form:
--accepting rule at line 53 ("the matched text")
The line number refers to the location of the rule in the file defining the scanner (the
input to the flex command). Messages are also generated when the scanner backtracks,
accepts the default rule, reaches the end of its input buffer (or encounters a NULL), or
reaches an End-of-File.
-f Specifies full table (no table compression is done). The result is large but fast. This flag
is equivalent to -Cf.
-i Instructs the flex command to generate a case-insensitive scanner. The case of letters
given in the flex input patterns is ignored, and tokens in the input are matched regardless
of case. The matched text given in the yytext variable will have the original case (as
read by the scanner).
-p Generates a performance report to the standard error file. This identifies features of the
flex input file that will cause a loss of performance in the resulting scanner.
-s Causes the default rule (that unmatched scanner input is echoed to the standard output
file to be suppressed. If the scanner encounters input that does not match any of its
rules, it aborts with an error.
-t Instructs the flex command to write the scanner it generates to the standard output file
instead of to the file lex.yy.c.
-v Specifies that the flex command should write to the standard error file a summary of
statistics regarding the scanner it generates.
-F Specifies that the fast scanner table representation should be used. This representation is
about as fast as the full table representation (the -f flag), and for some sets of patterns it
will be considerably smaller (and for others, larger). This flag is equivalent to the -CF
flag.
-I Instructs the flex command to generate an interactive scanner; that is, a scanner that
stops immediately rather than looking ahead if it knows that the currently scanned text
cannot be part of a longer rule’s match. Note that the -I flag cannot be used with full or
fast tables; that is, with the -f, -F, -Cf,or-CF flags.
-L Instructs the flex command not to generate #line directives in the file lex.yy.c. The
default action is to generate such directives so error messages in the actions will be
correctly located with respect to the original flex input files.
527188-003 Hewlett-Packard Company 3−143