Formatter collapses unequal legal indentation levels and emits unparseable source
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 3
- Fork
- 7
- Merge trung bình
- 4 giờ 7 phút
- Pull request đã merge (30 ngày)
- 112
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InauguralSystems/EigenScript
-
area:embed kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
InauguralSystems/EigenScript#1387 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:stdlib kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
InauguralSystems/EigenScript#1378 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:gates kind:gate-defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
InauguralSystems/EigenScript#1374 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminalĐang mởarea:lint-tooling kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
InauguralSystems/EigenScript#1373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:gates kind:docs-drift
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
InauguralSystems/EigenScript#1372 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của InauguralSystems/EigenScript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
BasedHardware/omi#19711 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/ebpf-for-windows#5604 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
trezor/trezor-firmware#7985 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày