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

Simplify the lexer_starts_with function #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RHL120
Copy link

@RHL120 RHL120 commented Feb 12, 2023

No description provided.

@BillKek
Copy link
Contributor

BillKek commented Feb 12, 2023

It became harder to understand.

@RHL120
Copy link
Author

RHL120 commented Feb 12, 2023

It became harder to understand.

Hmm, maybe you are right but to me I can read it in simple english:
if the prefix's length is zero or the the length of the rest of the string (after the cursor) is more than the prefix length and if the string starts with the prefix.
If the string were NULL terminated the second condition could be removed but I checked and it does not seem to be. Plus the previous function implemented the libc function strncmp.
Thanks for the review!

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