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

Formatter collapses unequal legal indentation levels and emits unparseable source

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
compilers

調査の方向性

Start with src/fmt.c:352–382 and docs/SPEC.md:69, then run the supplied indent.eigs commands after a fresh default make build. Exercise the reproducer and the listed unequal-increment, sibling, dedent, and 2-/4-space cases; done means formatted programs remain parseable, preserve execution output, and satisfy the stated regression checks.

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

説明

area:lint-tooling bug found-by:code-review

Formatting a valid nested block can collapse two different indentation levels and make the program fail to parse. --fmt returns success; --fmt --write would replace the working source with that result. The LSP formatting handler uses the same formatter.

Reproduction

Save this as indent.eigs. The two indented lines use four and six spaces, respectively:

if 1:
    if 1:
      print of 7
print of 9
eigenscript indent.eigs
eigenscript --fmt indent.eigs > formatted.eigs
eigenscript formatted.eigs

Original: exit 0, stdout 7\n9\n. Formatter: exit 0, but emits:

if 1:
    if 1:
    print of 7
print of 9

The result exits 1 with Parse error line 3:5: expected indent, got identifier ('print').

Cause and contract

docs/SPEC.md:69 requires consistent indentation within a block, not equal increments between blocks. The original program executes successfully.

src/fmt.c:352–382 finds the smallest positive indentation (4 here), then computes level = indents[i] / min_indent. Integer division maps both 4 and 6 to depth 1. Formatting needs to preserve the actual nesting/dedent structure instead of deriving it from one global width.

Regression acceptance

  • Formatting the reproducer preserves successful execution and its exact output.
  • Cover unequal indentation increments, sibling blocks, dedents, and ordinary 2-/4-space inputs.
  • Assert parseability and output after applying the formatter; idempotence alone cannot detect this corruption.

Distinct from #729/#750, which address splitting operators and keeping the operator table synchronized.

Verification

Confirmed with a fresh default make build of b91768e23c5a874a64e76e4af9ab291e6aa49983 in a clean isolated worktree. The original, formatter, and transformed program were executed separately with inherited EIGS_* variables removed; exit status and output were captured for each.

主要言語
C
スター
3
フォーク
7
平均マージ
3時間 58分
マージ済み PR(30日)
105

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

InauguralSystems/EigenScript のほかの issue

InauguralSystems/EigenScript の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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