Closed caioliberali closed 3 years ago
@caioliberali It's not possible with the current implementation of this node binding to the tree-sitter C library cause this binding doesn't expose control for underling tree-sitter query cursor, it buffers all captures before return them to the JS code.
If there would be such cursor control it would be possible to implement such stopping programmatically by capturing protected:
specifier and stop to consume the cursor production.
@caioliberali I was partially wrong due to missing declarations in tree-sitter.d.ts
file.
There is a Query.captures(rootNode: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryCapture[];
method so you can try to find position of the protected:
specifier by another query and pass its position in your query to stop it.
Thank you very much @ahlinc !!
Is it possible to query until node "is not equal", for example? I'm trying to query only the public fields in a C++ file.
Example: Tree-Sitter Playground
Query:
I doesn't return "protected:" accessor but still return its variables, but if I use another query, it starts from "protected:" accessor:
How could I solve this? Thank you.