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

refactor: simplify parser ? #330

Merged
merged 17 commits into from
Apr 12, 2025
Merged

refactor: simplify parser ? #330

merged 17 commits into from
Apr 12, 2025

Conversation

juleswritescode
Copy link
Collaborator

@juleswritescode juleswritescode commented Apr 12, 2025

This is just a suggestion! When looking into the parser, I was sometimes confused by some variable names. Maybe this reduces cognitive load?

  1. Some renamings:
    next_pos to current_pos (it's actually current_pos)
    peek() to current() (peek and look_ahead seemed to do the same)

  2. Removed eat, since it was only used once

  3. Added a is_relevant method which is more readable than !is_irrelevant (to me at least)

and 4. Changed some manual loops to Rust native iterators

Again, just a suggestion – the code was already great, and I don't want to be too invasive 🙌

@juleswritescode juleswritescode changed the title refactor: simplify parser refactor: simplify parser ? Apr 12, 2025
Copy link
Collaborator

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

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

makes sense!

@psteinroe psteinroe merged commit 70f0c93 into main Apr 12, 2025
7 checks passed
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