23 Diagnostics
The following is a list of flex
diagnostic messages:
- ‘warning, rule cannot be matched’ indicates that the given rule
cannot be matched because it follows other rules that will always match
the same text as it. For example, in the following ‘foo’ cannot be
matched because it comes after an identifier “catch-all” rule:
[a-z]+ got_identifier();
foo got_foo();
Using REJECT
in a scanner suppresses this warning.
- ‘warning, -s option given but default rule can be matched’ means
that it is possible (perhaps only in a particular start condition) that
the default rule (match any single character) is the only one that will
match a particular input. Since ‘-s’ was given, presumably this is
not intended.
-
reject_used_but_not_detected undefined
or
yymore_used_but_not_detected undefined
. These errors can occur
at compile time. They indicate that the scanner uses REJECT
or
yymore()
but that flex
failed to notice the fact, meaning
that flex
scanned the first two sections looking for occurrences
of these actions and failed to find any, but somehow you snuck some in
(via a #include file, for example). Use %option reject
or
%option yymore
to indicate to flex
that you really do use
these features.
- ‘flex scanner jammed’. a scanner compiled with
‘-s’ has encountered an input string which wasn’t matched by any of
its rules. This error can also occur due to internal problems.
- ‘token too large, exceeds YYLMAX’. your scanner uses
%array
and one of its rules matched a string longer than the YYLMAX
constant (8K bytes by default). You can increase the value by
#define’ing YYLMAX
in the definitions section of your flex
input.
- ‘scanner requires -8 flag to use the character 'x'’. Your scanner
specification includes recognizing the 8-bit character ‘'x'’ and
you did not specify the -8 flag, and your scanner defaulted to 7-bit
because you used the ‘-Cf’ or ‘-CF’ table compression options.
See the discussion of the ‘-7’ flag, Scanner Options, for
details.
- ‘flex scanner push-back overflow’. you used
unput()
to push
back so much text that the scanner’s buffer could not hold both the
pushed-back text and the current token in yytext
. Ideally the
scanner should dynamically resize the buffer in this case, but at
present it does not.
- ‘input buffer overflow, can't enlarge buffer because scanner uses
REJECT’. the scanner was working on matching an extremely large token
and needed to expand the input buffer. This doesn’t work with scanners
that use
REJECT
.
- ‘fatal flex scanner internal error--end of buffer missed’. This can
occur in a scanner which is reentered after a long-jump has jumped out
(or over) the scanner’s activation frame. Before reentering the
scanner, use:
or, as noted above, switch to using the C++ scanner class.
- ‘too many start conditions in <> construct!’ you listed more start
conditions in a <> construct than exist (so you must have listed at
least one of them twice).