Skip to content

Commit

Permalink
refactor: Simplify emitted prefix/postfix parser helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Dec 6, 2023
1 parent d41f4de commit e87811b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ impl PrecedenceParserDefinitionNodeExtensions for PrecedenceParserDefinitionNode
if !prefix_operator_parsers.is_empty() {
let prefix_operator_parser = make_choice(prefix_operator_parsers);
operator_closures.push(quote! { let prefix_operator_parser = |input: &mut ParserContext| #prefix_operator_parser; });
binary_operand_terms.push(
quote! { ZeroOrMoreHelper::run(input, |input| prefix_operator_parser(input)) },
);
binary_operand_terms
.push(quote! { ZeroOrMoreHelper::run(input, prefix_operator_parser) });
}

let primary_expression_parser = self.primary_expression.to_parser_code(context_name, false);
Expand All @@ -163,9 +162,8 @@ impl PrecedenceParserDefinitionNodeExtensions for PrecedenceParserDefinitionNode
if !postfix_operator_parsers.is_empty() {
let postfix_operator_parser = make_choice(postfix_operator_parsers);
operator_closures.push(quote! { let postfix_operator_parser = |input: &mut ParserContext| #postfix_operator_parser; });
binary_operand_terms.push(
quote! { ZeroOrMoreHelper::run(input, |input| postfix_operator_parser(input)) },
);
binary_operand_terms
.push(quote! { ZeroOrMoreHelper::run(input, postfix_operator_parser) });
}

let binary_operand_parser = make_sequence(binary_operand_terms);
Expand Down
20 changes: 5 additions & 15 deletions crates/solidity/outputs/cargo/crate/src/generated/language.rs

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

20 changes: 5 additions & 15 deletions crates/solidity/outputs/npm/crate/src/generated/language.rs

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

0 comments on commit e87811b

Please sign in to comment.