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

Add Span::lines_span() #682

Merged
merged 2 commits into from
Aug 4, 2022
Merged

Add Span::lines_span() #682

merged 2 commits into from
Aug 4, 2022

Conversation

Alextopher
Copy link
Contributor

The other half of closing #455 #456.

@Alextopher Alextopher requested a review from a team as a code owner August 3, 2022 14:53
@Alextopher Alextopher requested review from tomtau and removed request for a team August 3, 2022 14:53
self.pos = pos.find_line_end();
Some(line)

Span::new(self.span.input, line_start, self.pos)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous implementation this unsafely used Span::new_unchecked. It should be safe because find_line_end should never extend pass input. We could save a few bounds check however it's not necessary.

pest/src/span.rs Outdated Show resolved Hide resolved
pest/src/span.rs Outdated Show resolved Hide resolved
@tomtau tomtau enabled auto-merge (squash) August 4, 2022 01:11
@tomtau tomtau merged commit 9a93978 into pest-parser:master Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants