-
Notifications
You must be signed in to change notification settings - Fork 11
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
Split parser into main entrypoint and two helpers #211
Conversation
c19edee
to
5656a38
Compare
Ooh, I like that this cleans up the massive function. I wonder about the names. Both functions are parsing expressions and I don't know how name a meaningful difference between the two. The latter feels more cleanly like a |
Unrelated, I gotta figure out how to turn off preview deploys and building Docker images for others' PRs. Sorry about the red Xes. |
No worries! |
I think that As a side note, I really appreciate how you have a lot of unit tests in the code. It really does make a world of a difference when trying out small refactors such as this. |
Let's go with |
parse_expression
function to simplify parserThe driver function is still named `parse`. It does not accept any precedence parameter and simply calls into the `parse_binary` helper function using an initial precedence of 0. `parse_binary` now contains the logic of the previous `parse` function. The precedence parameters of `parse_unary` and `parse_binary` are made non-optional.
6b79431
to
c737c52
Compare
Thank you! |
parse
now calls intoparse_expression
and is a bit easier to read.