bug: namespace_definition and attributes issue

オープン
#376 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, javascript
領域
compilers

調査の方向性

The namespace_definition rule lives in grammar.js, so start there and check where attribute_specifier is already allowed in neighbouring rules. Add optional attribute specifiers before and after the name, regenerate the parser, and confirm both repro snippets in the issue parse without ERROR nodes. Done means a corpus test in test/corpus covering both placements passes with tree-sitter test.

索引モデルが issue の本文から書いたものです。

説明

bug
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-cpp
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

0.27.0

Describe the bug

namespace_definition symbol should be completed with optional($.attribute_specifier) before and after name field.

Steps To Reproduce/Bad Parse Tree

try to put legal c++ namespace definition to namespace __attribute__ (( __visibility__ ( default ))) ns {} to standard playground and you will get syntax error. The attribute specifier should be optionally accepted before and after name. This code copy-pasted from linux std include dir.

Expected Behavior/Parse Tree

no error

Repro
namespace __attribute__ (( __visibility__ ( default ))) ns {}  // Code that causes a parse error
namespace ns __attribute__ (( __visibility__ ( default ))) {}  // Code that causes a parse error too
}
主要言語
JavaScript
スター
463
フォーク
194
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tree-sitter/tree-sitter-cpp のほかの issue

tree-sitter/tree-sitter-cpp の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。