-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Unmacro parser combinators #6648
base: main
Are you sure you want to change the base?
Conversation
402b4e9
to
fdc372d
Compare
Oops, looks like I forgot to check doctests |
3085fb6
to
f4af581
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great change. Thank you!
f4af581
to
6fee7de
Compare
This implementation requires that the type of the value impls `Clone`, which means the function version of `succeed` cannot be used to succeed with values of non-`Clone` types. If this becomes an issue, we could either bring back the macro version, or create a new `succeed_with` function that takes a `Fn() -> T` argument. `succeed_with` could then be used to succeed with values that aren't `Clone` by creating the value on-demand each time the parser is run.
Previously said that `indented_seq` was similar to `and`, but it's more like `skip_first`. `and` returns a tuple of both parsers' outputs, but `indented_seq` only returns the output of the second parser, just like `skip_first`.
6fee7de
to
f44064e
Compare
This has conflicts now. @JackoCoolio would you prefer to resolve them or would you like one of us to pick up the conflict resolution? |
Thank you for your contribution! Sometimes PRs end up staying open for a long time without activity, which can make the list of open PRs get long and time-consuming to review. To keep things manageable for reviewers, this bot automatically closes PRs that haven’t had activity in 60 days. This PR hasn’t had activity in 30 days, so it will be automatically closed if there is no more activity in the next 30 days. Keep in mind that PRs marked |
This PR converts a bunch of the macro parser combinators in
parser.rs
back into regular functions. They were previously converted to macros so that the rust compiler didn't explode, but it's gotten better since then, and I don't run into any issues with compilation. As a bonus, compilingroc_parse
is now about 1.5s faster on my machine.See zulip discussion here.