-
Notifications
You must be signed in to change notification settings - Fork 13
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
is there a way to repeat elements in patterns #16
Comments
It will be a good improvement to add this! And the implementation should be trivial as treesitter already has repetitions. However I don't have a good design for the syntax yet.
|
I think the rust macro syntax is nice because it also solves the problem of the syntax of the replacement part. |
Rust declarative macro syntax is great, however there's too many $ and parens. It's hard to add repetition to a normal pattern, because you need to surround some structure with I'v came up with following design and I plan to implement this feature after multi-file search. Syntax
SeparatorsSeparators are important when it comes to repetition. They'll be any non-named nodes between previous sibling and the
In fn f() {
let a = 1;
$..
} the separartor is These separators will chain every instance of repetition nicely and the output of ssr will be well formatted. More examplesRust
Convert
|
nice! |
Temporary fix. Will remove all=false when implementing #16
Hello, is there a way to write a pattern that transforms
[ f(1), f(2), .... any number of f(integer) ]
intomap(f, [ 1, 2, any number of integers ])
?If I understand correctly tree sitter queries support wildcards such as
*
.The text was updated successfully, but these errors were encountered: