Closed c4lliope closed 3 years ago
No, there's no query system like that. There's no support for 'fields' either. The only helper for selective tree-walking is getChild
(in combination with 'group' properties on node types), which is quite minimal.
I did look into this, but it felt too heavyweight for this library (support for fields would grow the size of each node value in memory, and a query language would add quite a bit of code that every client has to download).
No problem – nice reasoning, and thanks for the quick reply.
I was pleased to find that this library took inspiration from Tree-Sitter; there seems to be no better example of how to build an editor-ingrained parser which can handle reparsing a syntax tree on each keystroke.
I am curious if the inspiration of copying Tree-Sitter's basic constructs extends to copying their "Query" API – see the docs and the playground.
I am deciding on a parser for my in-browser editor program, and I am inspired by Lezer's being Javascript-native, but I need query support for detecting common refactorings that are possible in the code.
I couldn't find any documentation in Lezer regarding querying syntax trees; am I missing the feature someplace?
Much obliged.