Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lsf37 opened this issue Feb 15, 2015 · 8 comments
Closed

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

lsf37 opened this issue Feb 15, 2015 · 8 comments
Labels
bug

Comments

@lsf37
Copy link
Member

@lsf37 lsf37 commented Feb 15, 2015

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)

@lsf37 lsf37 changed the title dangerous lookahead check may fail [Bug] dangerous lookahead check may fail [sf#38] Feb 15, 2015
@lsf37 lsf37 added this to the jflex bug milestone Feb 15, 2015
@lsf37 lsf37 closed this Feb 15, 2015
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

  • status: open --> open-later
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

  • priority: 7 --> 2
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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).

@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

fixed in svn revision 299.

@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

  • status: open-later --> open-fixed
@lsf37
Copy link
Member Author

@lsf37 lsf37 commented Feb 15, 2015

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

  • status: open-fixed --> closed
@lsf37 lsf37 added the bug label Feb 17, 2015
@lsf37 lsf37 modified the milestone: jflex bug Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.