Skip to content

[Bug] dangerous lookahead check may fail [sf#38] #40

@lsf37

Description

@lsf37

Reported by lsf37 on 2001-05-04 21:15 UTC
for some lookahead expressions JFlex will fail to print a warning that they are dangerous (r1 / r2 is
dangerous if any postfix of r1 matches a prefix r2).

Example:

.+ "a" / "b" .+ { action }

will not produce a warning/error message, but the postfix .+"a" of r1 matches a prefix of r2 (the
whole lookahead).

These lookahead expressions might match some inputs incorrectly. It is guaranteed that the rule
gets chosen if there is a match for the expression r1r2 (concatenation of r1 and r2), and it is
guaranteed that yytext() matches r1. It is not guaranteed that there is an instance of r2 after
yytext() (because too few lookahead characters were put back into the input).

Workaround: check manually if your lookahead expressions are dangerous.

(reported by Robert Hubley)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions