Skip to content

Commit

Permalink
fix: Try to resolve every item in DSL v2 codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Nov 9, 2023
1 parent 8e11a12 commit e64477f
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ fn resolve_separated(

fn resolve_precedence(
item: model::PrecedenceItem,
lex_ctx: &'static str,
ctx: &mut ResolveCtx,
) -> codegen_grammar::PrecedenceParserDefinitionNode {
let primaries = item
Expand Down Expand Up @@ -570,7 +571,7 @@ fn resolve_precedence(
// And ideally, we shouldn't even use the "enabled" mode of the original DSL
let thunk = Rc::new(NamedParserThunk(
name.to_string().leak(),
"TODO",
lex_ctx,
OnceCell::new(),
));

Expand Down Expand Up @@ -815,7 +816,7 @@ fn resolve_grammar_element(ident: &Identifier, ctx: &mut ResolveCtx) -> GrammarE
Item::Precedence { item } => {
thunk
.as_precedence_def()
.set(resolve_precedence(item.clone(), ctx))
.set(resolve_precedence(item.clone(), lex_ctx, ctx))
.unwrap();
}
_ => unreachable!("Only non-terminals can be resolved here"),
Expand Down Expand Up @@ -899,18 +900,7 @@ impl GrammarConstructorDslV2 for codegen_grammar::Grammar {
)) as Rc<dyn codegen_grammar::TriviaParserDefinition>;

for (_lex_ctx, item) in items.values() {
match item.as_ref() {
Item::Trivia { .. }
| Item::Fragment { .. }
| Item::Token { .. }
| Item::Keyword { .. }
| Item::Struct { .. }
| Item::Enum { .. }
| Item::Separated { .. }
| Item::Repeated { .. } => resolve_grammar_element(item.name(), &mut ctx),
// TODO: For now skip the elements that are not yet supported
Item::Precedence { .. } => continue,
};
resolve_grammar_element(item.name(), &mut ctx);
}
let resolved_items = ctx
.resolved
Expand Down

0 comments on commit e64477f

Please sign in to comment.