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

Potential issue with string example #23

Open
tomtau opened this issue Jul 15, 2022 · 0 comments
Open

Potential issue with string example #23

tomtau opened this issue Jul 15, 2022 · 0 comments

Comments

@tomtau
Copy link
Contributor

tomtau commented Jul 15, 2022

Currently the literals section of the book gives this as a string example:

string = { "\"" ~ (raw_string | escape)* ~ "\"" }

Is my understanding correct that this will parse " USA" as USA, discarding the initial , because the rule isn't atomic?

I'm having this issue myself. I'm getting around it by making the rule atomic, but it seems rules can't be atomic & silent, and so the parse tree contains the "s, which requires a bit more work downstream.

Thanks!

Originally posted by @max-sixty in pest-parser/pest#645

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

No branches or pull requests

1 participant