Alias not queriable
JoranHonig opened this issue · comments
Problem
I've defined an alias here: https://github.com/JoranHonig/tree-sitter-solidity/blob/master/grammar.js#L791
I'd expect to be able to query for binary_operator nodes as such:
(binary_operator) @operator
Steps to reproduce
git clone git@github.com:JoranHonig/tree-sitter-solidity.git
tree-sitter generate
cat " (binary_operator) @operator" > example.scm
touch sample.sol
tree-sitter-query example.scm sample.sol
Expected behavior
No query error
Tree-sitter version (tree-sitter --version)
tree-sitter 0.22.4
Operating system/version
=
might be similar to #2641, don't remember exactly
thanks for the report; I thought this was handled
your parser.c code is not up to date, that's the issue. it is currently using binaryOperator
- see the diff of me generating using 0.20.6:
Also - I recommend not aliasing a choice of many operators under one uniform named node - it makes checking for the text/querying for specific kinds of operators a bit more annoying, it's better to tie them to a field called operator
(which you already have), but leave it as-is as a terminal/token