Next: , Previous: , Up: Scanner Options   [Contents][Index]


16.5 Debugging Options

-b, --backup, %option backup

Generate backing-up information to lex.backup. This is a list of scanner states which require backing up and the input characters on which they do so. By adding rules one can remove backing-up states. If all backing-up states are eliminated and ‘-Cf’ or -CF is used, the generated scanner will run faster (see the ‘--perf-report’ flag). Only users who wish to squeeze every last cycle out of their scanners need worry about this option. (see Performance).

-d, --debug, %option debug

makes the generated scanner run in debug mode. Whenever a pattern is recognized and the global variable yy_flex_debug is non-zero (which is the default), the scanner will write to stderr 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 (i.e., the file that was fed to flex). Messages are also generated when the scanner backs up, accepts the default rule, reaches the end of its input buffer (or encounters a NUL; at this point, the two look the same as far as the scanner’s concerned), or reaches an end-of-file.

-p, --perf-report, %option perf-report

generates a performance report to stderr. The report consists of comments regarding features of the flex input file which will cause a serious loss of performance in the resulting scanner. If you give the flag twice, you will also get comments regarding features that lead to minor performance losses.

Note that the use of REJECT, and variable trailing context (see Limitations) entails a substantial performance penalty; use of yymore(), the ‘^’ operator, and the ‘--interactive’ flag entail minor performance penalties.

-s, --nodefault, %option nodefault

causes the default rule (that unmatched scanner input is echoed to stdout) to be suppressed. If the scanner encounters input that does not match any of its rules, it aborts with an error. This option is useful for finding holes in a scanner’s rule set.

-T, --trace, %option trace

makes flex run in trace mode. It will generate a lot of messages to stderr concerning the form of the input and the resultant non-deterministic and deterministic finite automata. This option is mostly for use in maintaining flex.

-w, --nowarn, %option nowarn

suppresses warning messages.

-v, --verbose, %option verbose

specifies that flex should write to stderr a summary of statistics regarding the scanner it generates. Most of the statistics are meaningless to the casual flex user, but the first line identifies the version of flex (same as reported by ‘--version’), and the next line the flags used when generating the scanner, including those that are on by default.

--warn, %option warn

warn about certain things. In particular, if the default rule can be matched but no default rule has been given, the flex will warn you. We recommend using this option always.


Next: , Previous: , Up: Scanner Options   [Contents][Index]