Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Function calls incorrectly formatted

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

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

評価

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

調査の方向性

示されている Zeek のスニペットと tree-sitter の parse コマンドで問題を再現します。式と関数呼び出しのパースおよびフォーマットの挙動を追跡します。完了の条件は、隣接する呼び出しが正しい CST を生成し、長い呼び出しチェーンが引数の内部で途切れなくなり、すべての呼び出しを inlay hints 用に照合できることです。

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

説明

When many function calls are part of the same expression they can be broken incorrectly, e.g., the following input

f(1) + f(1) +
f(1) + f(1) +
f(1) + f(1) +
f(1) + f(1) +
f(1) + f(1) +
f(1) + f(1) +
f(1) + f(1) +
f(1) + f(1);

is formatted with a line break inside the function call

f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(1) + f(
    1) + f(1) + f(1) + f(1);

Looking at the produced CST this seems to be due to function calls in expressions not parsing correctly, e.g., with

f(1) + f(1);

I get

$ tree-sitter parse foo.zeek
(source_file [0, 0] - [1, 0]
  (stmt [0, 0] - [0, 12]
    (expr [0, 0] - [0, 11]
      (expr [0, 0] - [0, 8]
        (expr [0, 0] - [0, 4]
          (expr [0, 0] - [0, 1]
            (id [0, 0] - [0, 1]))
          (expr_list [0, 2] - [0, 3]
            (expr [0, 2] - [0, 3]
              (constant [0, 2] - [0, 3]
                (integer [0, 2] - [0, 3])))))
        (expr [0, 7] - [0, 8]
          (id [0, 7] - [0, 8])))
      (expr_list [0, 9] - [0, 10]
        (expr [0, 9] - [0, 10]
          (constant [0, 9] - [0, 10]
            (integer [0, 9] - [0, 10]))))))
  (nl [0, 12] - [1, 0]))

If this had correct precedence I would expect two nodes (expr (expr (id)) (expr_list ...) next to each other; instead the function name of the second f gets incorrectly grouped next to the arguments of the first call.

The current "lightweight" impl also makes it impossible to match multiple function calls in the same expression, e.g., over in https://github.com/bbannier/zeek-language-server I cannot match all calls to compute parameter inlay hints, e.g.,

Screenshot 2023-12-16 at 1 20 29 AM
主要言語
Python
スター
11
フォーク
4
平均マージ
3日 19時間
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

zeek/zeekscript のほかの issue

zeek/zeekscript の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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