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

Fix bug in parsing hex char escapes #36

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

RadixSeven
Copy link
Contributor

Bugfix: the parser would crash if it encountered "\x5C" in a grammar. This commit fixes that bug. (There is still a bug I couldn't locate that causes the parser to crash with "\\". But the "\x5C" provides a workaround.)

The bug was that the parsing code returned an int instead of a str, as the client code expected.

This commit also adds some test cases I used to find the problem.

Eric Moyer and others added 2 commits April 15, 2024 19:00
It was returning an int not a string. This commit also adds
some test cases I used to find the problem.
@Saibo-creator
Copy link
Collaborator

Saibo-creator commented Apr 19, 2024

@RadixSeven Thanks for your contribution! The fix seems good to me :)

Just to clarify before we proceed with the merge:

There's still an elusive bug that causes the parser to crash when using "\". However, using "\x5C" seems to be a viable workaround.

Could you provide a specific example where the parser fails? I'm not clear on that.

The parser functions correctly with both:

root ::= ("\x61" "\x5C")*

and

root ::= ("\x61" "\\")*

The output, a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a, appears as expected.

@Saibo-creator Saibo-creator merged commit 84edde2 into epfl-dlab:main Apr 22, 2024
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