Skip to content

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

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)

Activity

  1. changed the title [-]dangerous lookahead check may fail[/-] [+][Bug] dangerous lookahead check may fail [sf#38][/+] on Feb 15, 2015
  2. added this to the milestone on Feb 15, 2015
  3. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Commented by lsf37 on 2001-05-04 21:16 UTC
    Logged In: YES
    user_id=93534

    it is not clear yet wether this bug will be fixed soon

  4. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Updated by lsf37 on 2001-09-27 13:05 UTC

    • status: open --> open-later
  5. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Commented by lsf37 on 2004-11-07 06:05 UTC
    Logged In: YES
    user_id=93534

  6. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Updated by lsf37 on 2004-11-07 06:05 UTC

    • priority: 7 --> 2
  7. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Commented by lsf37 on 2004-11-07 06:08 UTC
    Logged In: YES
    user_id=93534

    The warning is now safe (version 1.4.1), but very crude (reports
    way too many cases as unsafe).

  8. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Commented by lsf37 on 2007-11-25 11:53 UTC
    Logged In: YES
    user_id=93534
    Originator: YES

    fixed in svn revision 299.

  9. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Updated by lsf37 on 2007-11-25 11:53 UTC

    • status: open-later --> open-fixed
  10. lsf37 commented on Feb 15, 2015

    @lsf37
    MemberAuthor

    Updated by lsf37 on 2008-05-27 11:46 UTC

    • status: open-fixed --> closed
  11. modified the milestone: on Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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