Skip to content

"&" inside a macro isn't recognized #98

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

Closed
stsewd opened this issue Jan 3, 2021 · 2 comments · Fixed by #185
Closed

"&" inside a macro isn't recognized #98

stsewd opened this issue Jan 3, 2021 · 2 comments · Fixed by #185

Comments

@stsewd
Copy link

stsewd commented Jan 3, 2021

println!("{}", &foo);

Here the query "&" @operator doesn't match the &, if the macro is changed for a function call it works

println("{}", &foo);
@resolritter
Copy link
Contributor

I think this could relate to #96.

This could be more broadly described as "individual tokens are not designated inside of token_tree" since other valid operators, such as ^, are also not designated inside of them. They are indeed not currently queryable inside of token_trees

tree-sitter-rust/grammar.js

Lines 190 to 193 in 2beedf2

_non_special_token: $ => choice(
$._literal, $.identifier, $.metavariable, $.mutable_specifier, $.self, $.super, $.crate,
alias(choice(...primitive_types), $.primitive_type),
/[/_\-=->,;:::!=?.@*=/=&=#%=^=+<>|~]+/,

@maxbrunsfeld @ninevra what do you think of this in light of the ideas in #96? Are those concerns relatable? Also should those tokens be queryable inside of token_tree?

@baptisteroziere
Copy link

Hi. I'm experiencing what I think is a related issue:
With

println!("{}", var1 + var2);

the "," and "+" are not in the ast.

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 a pull request may close this issue.

3 participants