Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements to Query.Builder API #49

Merged
merged 8 commits into from
Oct 31, 2023
Merged

Enhancements to Query.Builder API #49

merged 8 commits into from
Oct 31, 2023

Conversation

dabico
Copy link
Member

@dabico dabico commented Oct 31, 2023

The biggest change of this PR is that patterns can now be specified and added individually, overwritten with a new list of patterns and even reset. A lot of inspiration was borrowed from #48, including the toBuilder. The static factory was also changed to offer support for these features.

This does not modify the native code, as all the patterns are joined at
the very end to form a single pattern which is then fed to the
tree-sitter API.
This variant is intended for specifying multiple patterns in one method
call. Although specifying the concatenation is technically correct, this
variant should be more easily readable.
Its purpose is to clear all the currently set patterns. This will be of
use when we introduce `toBuilder`.
Unlike `patterns(String...)` which mutates the pattern list by adding,
this variant is intended explicitly for overwriting the currently set
patterns with a completely new list. This method will essentially make
`Query` mutations possible when `toBuilder` is introduced.
@dabico dabico merged commit 6f393bf into master Oct 31, 2023
2 checks passed
@dabico dabico deleted the enhancement/query branch October 31, 2023 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant