Skip to content

Commit

Permalink
Fix nested binding
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyBlakey committed Mar 24, 2024
1 parent 54f405a commit bb92384
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/codegen/parser/treestuff/src/query/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ impl<T: ModuleInputs> Combinator<T> for BindingCombinator<T> {
.entry(self.matcher.name.clone())
.or_default()
.push(self.cursor.clone());
self.child.accumulate_bindings(bindings);
}
}

Expand Down
11 changes: 11 additions & 0 deletions crates/testlang/outputs/cargo/tests/src/query/engine_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,17 @@ fn test_optional() {
);
}

#[test]
fn test_nested() {
run_query_test(
&common_test_tree(),
"@root [TreeNode ... @z [DelimitedIdentifier] [_] ]",
query_results! {
{root: ["ABCDE"], z: ["C"]}
},
);
}

// #[test]
// fn test_query_and_apply_actions() {
// type Context = String;
Expand Down

0 comments on commit bb92384

Please sign in to comment.