-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Parser Refactor #627
Merged
Merged
Parser Refactor #627
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvcas
force-pushed
the
rvcas/parser_refactor
branch
3 times, most recently
from
June 28, 2023 00:17
4e4c4d2
to
b92d9f2
Compare
rvcas
force-pushed
the
rvcas/parser_refactor
branch
from
June 29, 2023 19:12
b92d9f2
to
43108a5
Compare
rvcas
force-pushed
the
rvcas/parser_refactor
branch
from
July 3, 2023 18:25
24aee8e
to
7f9e8bb
Compare
rvcas
force-pushed
the
rvcas/parser_refactor
branch
2 times, most recently
from
July 4, 2023 21:15
5e09e20
to
bd47731
Compare
We are going to start to add "golden"/snapshot tests, so we are using [insta](https://insta.rs) to do so.
We added a macro to add more information about the code that is being tested, so we can add lots and lots of small snapshot tests.
rvcas
force-pushed
the
rvcas/parser_refactor
branch
from
July 4, 2023 21:19
bd47731
to
47567c5
Compare
KtorZ
approved these changes
Jul 5, 2023
Nice work, that was desperately needed. It now makes me eager to go in each parser, one after the other to improve them and get some nice backtracking errors. I've left a few comments which I don't mind addressing myself or in a pairing session. I'll be on Discord streaming, feel free to join :) |
The 'public' util was arguably not really adding much except a layer of indirection. In the end, one useful parsing behavior to abstract is the idea of 'optional flag' that we use for both 'pub' and 'opaque' keywords.
Equality on a union-type is potentially dangerous as the compiler won't complain if we add a new case that we don't cover. Reversing the assignment by yielding a `Token` for a given `AssignmentKind`. This way we can use a pattern-match that got us covered for future cases.
Also moved the logic for 'int' and 'string' there though it is trivial. Yet, for bytearray, it tidies things nicely by removing them from the 'utils' module.
Better readability.
Alleviate a bit more the top-level expression parser. Note that we probably need a bit more disciplined in what we export and at what level because there doesn't seem to be much logic as for whether a parser is private, exported to the crate only or to the wide open. I'd be in favor of exporting everything by default.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #587