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

Weird parsing results with nested template argument list

Open
#192 4 comments 0 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

This example gives weird/inconsistent results leading me to believe there's an issue with parsing nested templates:

map<string, string> m;
map<string, vector<string>> m2;
map<string, vector<vector<string>>> v;

I expect to see all types highlighted, but the last line fails to highlight string in the first index to map; instead parsing it as an identifier when I expect type_identifier:

Screenshot 2023-02-24 at 9 42 46 AM

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

Reproduce the three nested-template declarations from the issue in the tree-sitter-cpp parser and inspect their parse or highlighting results. Trace how nested template arguments classify identifiers, then verify that every string in the example is highlighted as a type_identifier without regressing the simpler declarations.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.