Skip to content

Commit

Permalink
Inline the choice nodes in the CST
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Nov 12, 2023
1 parent 8f3e978 commit 37f880e
Show file tree
Hide file tree
Showing 146 changed files with 5,622 additions and 5,351 deletions.
17 changes: 15 additions & 2 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,21 @@ impl codegen_grammar::ParserDefinition for NamedParserThunk {
}

fn is_inline(&self) -> bool {
// The DSL v2 definition already inlines the elements
false
// HACK: Make sure all keywords are referred to by a parser, so that codegen includes them in the trie.
if self.name().ends_with("AllKeywords") {
return false;
}

// The DSL v2 definition already inlines the elements, however `Enum`s
// are not but should be, since they only have a single reference per variant.
match self.node() {
ParserDefinitionNode::Versioned(node, _) => match **node {
ParserDefinitionNode::Choice(_) => true,
_ => false,
},
ParserDefinitionNode::Choice(_) => true,
_ => false,
}
}

fn node(&self) -> &codegen_grammar::ParserDefinitionNode {
Expand Down
66 changes: 0 additions & 66 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.

Loading

0 comments on commit 37f880e

Please sign in to comment.