tree-sitter / tree-sitter/tree-sitter-cpp

No distinction between a function declaration and a variable declaration

Open
#124 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
453
Forks
185
PR merge metrics
No merged PRs in 30d

Description

The tree-sitter parser makes no distinction between a function declaration and this constructor call.
It even thinks that x or n in my example are types. So this is probably a tree-sitter-cpp issue.

image

Originally posted by @theHamsta in https://github.com/nvim-treesitter/nvim-treesitter/issues/1625#issuecomment-886098101

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the tree-sitter-cpp grammar and reconstruct the declaration and constructor-call example shown in the linked image. Compare the resulting parse trees, especially the treatment of x and n as types; done means function declarations and variable declarations are distinguished correctly without misclassifying those names.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.