-
Notifications
You must be signed in to change notification settings - Fork 219
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
fix: Correct off-by-one errors in lexer spans #2393
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give this a try in a bit tomorrow (I didn't realize how late it was)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, but I made changes so let's get other feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. If any more off by one spans are found we can fix them as part of another PR
* master: chore: improve error message for InternalError (#2429) chore: Add stdlib to every crate as it is added to graph (#2392) feat: create equivalence relationships for intermediate witnesses from multiplication (#2414) chore(ci): Fix version of `cross` to 0.2.5 (#2426) fix: Correct off-by-one errors in lexer spans (#2393)
Description
Problem*
Closes #1682
Resolves #1683
Summary*
This PR addresses the off-by-one errors in how we deal with spans in a way which makes sense to me.
For example in
parse_block_comment
we're creating a span which goes from the start of the comment to the very last character in the file. We should then have an inclusive span here. Similarly when we have a&&
we were previously creating a span of size 1 which doesn't really make sense for when we're capturing two characters.Based on this, I noticed that
from_position
was creating exclusive end spans whereas we're calling it in the same way where logically we should have inclusive spans. I then switched this and the red squigglies are all appearing where I expect them to be.Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.