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

Added expect for improved readability #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xtay2
Copy link
Contributor

@xtay2 xtay2 commented Jan 3, 2024

Both the tokenizer and the parser frequently check if the next peeked token exists and equals some expected value.

I added two utility functions that should improve the readability.

Copy link

@edy131109 edy131109 left a comment

Choose a reason for hiding this comment

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

Great code but in tokenization.hpp please don't replace the peek().value() == '' with the expect function because we already know that the peek() has a value from the upper statement and that just makes the code slower.

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