Skip to content

Commit

Permalink
refactor: Wrap matching into a helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
jpedroh committed Oct 28, 2023
1 parent 80cfab1 commit ea34157
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ fn main() {
let left_tree = parsing::parse_string(left, &parser_configuration).unwrap();
let right_tree = parsing::parse_string(right, &parser_configuration).unwrap();

let matchings_left_base = matching::ordered_tree_matching(&left_tree, &base_tree);
let matchings_right_base = matching::ordered_tree_matching(&right_tree, &base_tree);
let matchings_left_right = matching::ordered_tree_matching(&left_tree, &right_tree);
let matchings_left_base = matching::calculate_matchings(&left_tree, &base_tree);
let matchings_right_base = matching::calculate_matchings(&right_tree, &base_tree);
let matchings_left_right = matching::calculate_matchings(&left_tree, &right_tree);

let result = merge::merge(
&base_tree,
Expand Down
4 changes: 4 additions & 0 deletions matching/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ mod ordered_tree_matching;
pub use matching_entry::MatchingEntry;
pub use matchings::Matchings;
pub use ordered_tree_matching::ordered_tree_matching;

pub fn calculate_matchings<'a>(left: &'a model::CSTNode, right: &'a model::CSTNode) -> Matchings<'a> {
return ordered_tree_matching::ordered_tree_matching(left, right);
}

0 comments on commit ea34157

Please sign in to comment.