Skip to content

Commit

Permalink
Fix nested bindings in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyBlakey authored and Xanewok committed Apr 8, 2024
1 parent aa1c073 commit 790037c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/codegen/parser/runtime/src/query/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl Combinator for BindingCombinator {
.entry(self.matcher.name.clone())
.or_default()
.push(self.cursor.clone());
self.child.accumulate_bindings(bindings);
}
}

Expand Down

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

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

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 @@ -250,3 +250,14 @@ fn test_optional() {
},
);
}

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

0 comments on commit 790037c

Please sign in to comment.