Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

User Commands (k - l) lex(1)
NAME
lex - Generates a C language lexical analyzer
SYNOPSIS
lex [-bcdnpstvFILT8] -C[efmF][-Sskeleton][le ...]
FLAGS
-b Generates backtracking information to le 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 elim-
inated and the -f or -F ag 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 le 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 le dening the scanner (the
input to the lex 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 Species full table (no table compression is done). The result is large but fast. This
ag is equivalent to -Cf.
-i Instructs the lex command to generate a case-insensitive scanner. The case of letters
given in the lex input patterns is ignored, and tokens in the input are matched regard-
less 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 le. This identies features of the
lex input le 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
le to be suppressed. If the scanner encounters input that does not match any of its
rules, it aborts with an error.
-t Instructs the lex command to write the scanner it generates to the standard output le
instead of to the le lex.yy.c.
-v Species that the lex command should write to the standard error le a summary of
statistics regarding the scanner it generates.
-F Species that the fast scanner table representation should be used. This representation
is about as fast as the full table representation (the -f ag), and for some sets of patterns
it will be considerably smaller (and for others, larger). This ag is equivalent to the -
CF ag.
-I Instructs the lex 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 rules match. Note that the -I ag cannot be used with full or
fast tables; that is, with the -f, -F, -Cf,or-CF ags.
-L Instructs the lex command not to generate #line directives in the le 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 lex input les.
527188-003 Hewlett-Packard Company 549