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.
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 eachPrecedenceExpressionunder it contributes one.
There was a problem hiding this comment.
Could you elaborate a bit which side effect are you referring to here?
There was a problem hiding this comment.
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.
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