-
Notifications
You must be signed in to change notification settings - Fork 22
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
Inline the (Yul)Statement parser in v0/v1 #658
Conversation
|
...es/solidity/testing/snapshots/cst_output/TryStatement/try_catch/generated/0.4.11-failure.yml
Show resolved
Hide resolved
...es/solidity/testing/snapshots/cst_output/TryStatement/try_catch/generated/0.4.11-failure.yml
Show resolved
Hide resolved
|
||
Errors: # 1 total | ||
- > | ||
Error: Expected end of file. |
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.
This side effect is also true for Precedence
items, and for the same reason, since now they always result in a unique node (an operator expression, or a primary expression), they don't have to produce their own top-level nodes. From the design doc:
It is important to note that the item name doesn't contribute a
NonTerminalKind
, but eachPrecedenceExpression
under it contributes one.
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.
Could you elaborate a bit which side effect are you referring to here?
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.
I was commenting on:
Maybe it'd be better if we somehow allow to "outline" select enums in v2, like this one? @OmarTawfik
Are you suggesting this just for testing? I think I will have to introduce strongly typed parseEnumFoo() -> EnumFoo
at some point anyways. We can test its root node, even if it wasn't wrapped with an explicit NonTerminalKind
. Thoughts?
I was also mentioning that like Enum
items, Precedence
items also don't produce their own NonTerminalKind
, but their inner precedence_expressions
entries do.
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.
Right, I wanted to specifically say that being able to parse a general construct like "expression" or "statement" seems like something we want to do anyway, even if it doesn't have a dedicated rule kind in the CST (is inlined), so the future parseEnum
approach answers my concern.
Part of #652
Seems convenient for the AST/CST (to not need to unwrap another layer) but we lose the ability to test it as a named parser and the generated parser code gets a bit bloated, since we now inline the choice.
Maybe it'd be better if we somehow allow to "outline" select enums in v2, like this one? @OmarTawfik