Skip to content

fix(ja-notation): read a reading comma in block lines like の間,繰り返す: - #2275

Merged
smalruby3-editor-bot[bot] merged 1 commit into
topic/japanese-mode-1731from
fix/ja-notation-comma-2274
Nov 19, 2026
Merged

smalruby3-editor-bot[bot] merged 1 commit into
topic/japanese-mode-1731from
fix/ja-notation-comma-2274

Conversation

@smalruby3-editor-bot

Copy link
Copy Markdown

概要

日本語タブで x < 3 の間,繰り返す: のように読点を入れると「「の間」が読めません」になっていたのを直す。docs/dncl/policy.md の「見た目だけの揺れは、読むときは全部受け付け、書くときは 1 つにそろえる」に従う。

直し方

packages/ja-notation/src/parse.js に withoutReadingCommas を足し、行を読む前に、ブロックの行の決まった句の直後の読点を取り除く。

  • 読点: ,(, として読まれる)・、(いままで「読めない字」だった)・,。前後の空白・全角空白も可
  • 取り除くのは、直前が の間 / ならば / なら / そうでなければ / …増やしながら / …減らしながら で、直後が 繰り返す・:・行の終わりのときだけ。値の中の ,(f(a, b)・a = 0, b = 1)は今までどおり
  • 読めないままのもの(テストで確かめた): もし m > 0 ならば,s = 1(1 行の if はもともと書けない)、n < 5,の間繰り返す:

書き出し(Ruby → 日本語)は変えない(読点を入れない形)。

受け付けるようになった揺れ

書き方 同じ意味
n < 5 の間,繰り返す: / の間 、 繰り返す: / の間, 繰り返す: n < 5 の間繰り返す:
n < 5 の間,: n < 5 の間繰り返す:
n < 5 の間, … を繰り返す(DNCL 風) 同上
k を … 2 ずつ増やしながら,繰り返す: / ずつ 減らしながら、繰り返す: 読点なし
k を … ずつ増やしながら, … を繰り返す(DNCL 風) 同上
もし … ならば,: / そうでなくもし … ならば、: / そうでなければ,: 読点なし
もし … ならば, / なら, / そうでなければ, … を実行する(DNCL 風) 同上

テスト

  • packages/ja-notation/test/data/parse.json: same に 10 行(上の表)、errors に 2 行(読めないままのもの)
  • packages/ja-notation/test/data/ja-to-ruby.json: 読点を入れた while / if / else / 数える繰り返しの入れ子 1 件
  • packages/scratch-gui/test/unit/lib/dncl/dncl-validator.test.js: GUI の dnclToRuby を通して誤りが出ないこと、閉じ忘れの文言が今までどおりのこと
  • テストのプログラムはすべて自作
  • ゴールデン(J0): UPDATE_JA_GOLDEN=1 で作り直したが 差は 0(コーパスに読点のある形が無いため。意図どおり)
  • ローカル: node --test(ja-notation、242 件)、上の jest 2 ファイル、ja-notation と scratch-gui の lint

docs

docs/dncl/README.md の「読む書き方」の表に 1 行足した。

Closes #2274

🤖 Generated with Claude Code

The Japanese reader takes a `,` / `、` / `,` (with spaces) right after
`の間`, `ならば` / `なら`, `そうでなければ` and `増やしながら` / `減らしながら`
when it is followed by `繰り返す`, the `:` or the end of the line. Writing
stays without the comma.

Closes #2274

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed (stg API): https://preview.smalruby.app/fix-ja-notation-comma-2274-9dd23548/

@smalruby3-editor-bot
smalruby3-editor-bot Bot merged commit 9702518 into topic/japanese-mode-1731 Nov 19, 2026
11 checks passed
@smalruby3-editor-bot
smalruby3-editor-bot Bot deleted the fix/ja-notation-comma-2274 branch November 19, 2026 09:15

This branch was previously deployed

1 inactive deployment
stg — 1060d507 Deployed Nov 19, 2026 by smalruby3-editor-bot[bot] via cleanup #448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants