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

Optimize parsing of ranges #597

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Optimize parsing of ranges #597

merged 1 commit into from
Jan 6, 2022

Conversation

Kijewski
Copy link
Collaborator

@Kijewski Kijewski commented Jan 6, 2022

Right now almost every expression needs to be parsed twice: expr_any()
first parses the left-hand side of a range expression, and if no ..
or ..= was found the left-hand expression is parsed again, this time
as the result of the function.

This diff removes the second parsing step by first looking for
.. (opt rhs), then for lhs .. (opt rhs).

Right now almost every expression needs to be parsed twice: `expr_any()`
first parses the left-hand side of a range expression, and if no `..`
or `..=` was found the left-hand expression is parsed again, this time
as the result of the function.

This diff removes the second parsing step by first looking for
`.. (opt rhs)`, then for `lhs .. (opt rhs)`.
@Kijewski
Copy link
Collaborator Author

Kijewski commented Jan 6, 2022

Extracted from #590.

@djc djc merged commit af552ee into rinja-rs:main Jan 6, 2022
@Kijewski Kijewski deleted the pr-parse-ranges-once branch January 6, 2022 15:30
@djc djc mentioned this pull request Feb 26, 2023
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