Skip to content

Commit

Permalink
Inline the (Yul)Statement parser in v0/v1 (#658)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Xanewok authored Nov 15, 2023
1 parent b5f59c5 commit 3e4d2b6
Show file tree
Hide file tree
Showing 75 changed files with 2,118 additions and 1,809 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

- name: "Statement"
kind: "Parser"
inlined: true
versioned:
0.4.11:
choice:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

- name: "YulStatement"
kind: "Parser"
inlined: true
versioned:
0.4.11:
choice:
Expand Down
4 changes: 2 additions & 2 deletions crates/solidity/inputs/language/src/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ slang_grammar! {

parser StateVariableDefinition = ((TypeName (StateVariableAttributesList ?) Identifier ((Equal Expression) ?)) terminated by Semicolon) ;

parser Statement = (
inline parser Statement = (
SimpleStatement | ControlStatement | AssemblyStatement | Block | { introduced in "0.8.0" UncheckedBlock }
) ;

Expand Down Expand Up @@ -668,7 +668,7 @@ slang_grammar! {

parser YulReturnsDeclaration = (MinusGreaterThan YulIdentifiersList) ;

parser YulStatement = (
inline parser YulStatement = (
YulBlock | YulFunctionDefinition | YulDeclarationStatement | YulAssignmentStatement | YulIfStatement |
YulForStatement | YulSwitchStatement | { introduced in "0.6.0" YulLeaveStatement } |
YulBreakStatement | YulContinueStatement | YulExpression
Expand Down
4 changes: 0 additions & 4 deletions crates/solidity/outputs/cargo/crate/src/generated/kinds.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

464 changes: 367 additions & 97 deletions crates/solidity/outputs/cargo/crate/src/generated/language.rs

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions crates/solidity/outputs/npm/crate/src/generated/kinds.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3e4d2b6

Please sign in to comment.