Skip to content

bug: Parser errors when macros are invoked with multiple arguments #206

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
2 tasks done
ribru17 opened this issue Dec 20, 2023 · 2 comments
Closed
2 tasks done

bug: Parser errors when macros are invoked with multiple arguments #206

ribru17 opened this issue Dec 20, 2023 · 2 comments
Labels

Comments

@ribru17
Copy link

ribru17 commented Dec 20, 2023

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-rust

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

When giving a macro multiple arguments (e.g. println!("{}", "hello");), the parser errors with something like:

(expression_statement)
 (unit_expression)
  (ERROR)

Perhaps similar to #98

This is especially unfortunate when the inside of the macro contains a function call, as it will not be recognized as a function call and thus not selectable by a textobjects query.

Steps To Reproduce/Bad Parse Tree

(expression_statement) 
 (macro_invocation) 
  macro: (identifier) 
  (token_tree) 
   (expression_statement) 
    (unit_expression) 
     (ERROR) 
   (string_literal) 
   (identifier) 
   (token_tree) 

Expected Behavior/Parse Tree

(expression_statement) 
 (macro_invocation) 
  macro: (identifier) 
  (token_tree) 
   (string_literal) 
   (call_expression) 
    function: (identifier) 
    arguments: (arguments) 

Repro

println!("{}", returns_string_hello());
@ribru17 ribru17 added the bug label Dec 20, 2023
@amaanq
Copy link
Member

amaanq commented Dec 21, 2023

That's not the output from tree-sitter's CLI (hint: you're using neovim with injections inside macro invocations)

@amaanq amaanq closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@ribru17
Copy link
Author

ribru17 commented Dec 21, 2023

I see, my apologies. Thanks for the information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants