Repository navigation
fix(ja-notation): tell a closing word of another kind of block - #2269
Merged
smalruby3-editor-bot[bot] merged 7 commits intoNov 19, 2026
Merged
smalruby3-editor-bot[bot] merged 7 commits into
smalruby3-editor-bot[bot] merged 7 commits into
Conversation
…them The Japanese mode is written for a program that runs alone, as on a terminal, and has no stage. Ruby → Japanese tells each `$a` (a variable or a list of the stage) at its name as `stage-variable`, which the editor says as "ステージの変数($a)は日本語モードでは書けません。Ruby モードでは書けます。", in place of the no-ja-form error of the whole statement. Closes #1706 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Out of the strings and the comments, the lexer makes the full-width letters and digits half-width before it reads them (`x1` is `x1`, `and` is `and`), as the auto-correct of the Ruby mode does. A full-width letter is no longer a name of its own (the decision of #1714 is taken back). The strings and the comments keep what is written. Closes #2266 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A block of the DNCL-like form closed by the closing word of another kind (a もし closed by を繰り返す, a counting loop by を実行する) is now an error (`closer-kind`) that says the word of the block, even when the Ruby could be made: the students are told as much as can be. A block forgotten inside the one the word closes is told as not closed. `end` still closes any. Closes #2268 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🚀 Preview deployed (stg API): https://preview.smalruby.app/fix-ja-notation-closer-kind-3b499791/ |
smalruby3-editor-bot
Bot
merged commit Nov 19, 2026
b3028a4
into
topic/japanese-mode-1731
11 checks passed
This was referenced Nov 19, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
日本語モード EPIC #1731 の確認ページの答え W3。DNCL 風の形で、閉じる言葉とブロックの種類が合わないときを誤りにする(初心者に少しでも多く指摘する)。
もし x > 0 ならば/表示する(x)/を繰り返すi を 1 から 3 まで 1 ずつ増やしながら/ … /を実行するx < 3 の間繰り返す:/x = x + 1/と定義する〜の間の中のもしを閉じ忘れてを繰り返すもしを閉じて、外が閉じていないもしの行に「「もし〜ならば」を「を実行する」で閉じてください」(前と同じ文)… の間/ … /endendはどのブロックも閉じる。Ruby と同じ)標準の形(字下げ)では閉じる言葉を書かないので関係しない。
Changes Made
parse.js: 閉じの行の言葉をブロックの種類(closerOf)と照らし合わせる。合わないとき、間のブロックがすべて DNCL 風の形で、外に合うブロックがあれば内側をunclosedにして外を閉じ(matchingCloser)、無ければcloser-kind(word・expected・opener・direction・colon)の誤りにする。ja-notation-errors.js:closer-kindの文(:で開いたものは標準の形の名前)。closerFormBlockErrorsの説明を直した(ja-notation が同じことを言うようになった)。docs/dncl/README.md(DNCL 風の形の読み方・閉じ忘れのエラーの表と説明・誤りの欄)、docs/smalruby-dncl-spec.ja.md(終端キーワード)。Test Coverage
packages/ja-notation/test/data/parse.json: 誤り 6 行(もし / 〜の間 / 減らしながら / 関数 /:で開いたもの / 内側の閉じ忘れ)と、endが〜の間も閉じるsame1 行。packages/ja-notation/test/data/ja-to-ruby.json: 「数える繰り返しをほかの言葉で閉じても増分を足す」を、誤りになる期待に書きかえ。test/unit/lib/dncl/dncl-validator.test.js: 「数が合えば誤りにしない」を誤りになる期待に書きかえ、数える繰り返し・:で開いたもの・endを足した。UPDATE_JA_GOLDEN=1): 差なし(コーパスに種類の違う閉じの言葉で閉じたプログラムが無い)。Closes #2268
🤖 Generated with Claude Code