Skip to content

fix(ja-notation): read full-width letters and digits as half-width ones - #2267

Merged
smalruby3-editor-bot[bot] merged 4 commits into
topic/japanese-mode-1731from
fix/ja-notation-fullwidth-alnum
Nov 19, 2026
Merged

smalruby3-editor-bot[bot] merged 4 commits into
topic/japanese-mode-1731from
fix/ja-notation-fullwidth-alnum

Conversation

@smalruby3-editor-bot

Copy link
Copy Markdown

Summary

日本語モード EPIC #1731 の確認ページの答え W8。全角英字・全角数字を、文字列とコメントの外では読む前にすべて半角にする(Ruby モードの自動置換と同じ考え)。#1714 の「全角英字は別の名前」は取り消し。

重ねて作っています: #2263(D1)のブランチの上に作ったので、#2263 を先にマージしてください。それまではこの PR の差分に #2263 のコミットも見えます。

日本語 これまで これから
x1 = 12 x1 = 12(x1 は別の名前) x1 = 12
a > 0 and b and は名前 a > 0 && b
表示する("ABC") そのまま そのまま(文字列は変えない)
x = 1 # x は全角 コメントはそのまま コメントはそのまま

Changes Made

  • ja-notation lexer.js: tokenize が、次の文字列・コメントの始まりまでのコードを halfWidthAlphanumerics で半角にしてから読む(1 字ずつ同じ長さなので列は変わらない。// がコメントの記号のときも、そのコメントは変えない)。数の全角数字の扱い(fix(dncl): '2倍' and full-width digits like '12' make broken Ruby #1752)はこれに含まれ、名前の中の全角数字も半角になる。
  • docs: docs/dncl/README.md(名前に使える文字・lexer・表)、docs/dncl/policy.md(見た目だけの揺れの例)、docs/smalruby-dncl-spec.ja.md。

Test Coverage

  • packages/ja-notation/test/data/ja-to-ruby.json: 既存 3 行の期待を書きかえ(x1 → x1、x1 → x1、10回 の誤りの文が 「10回」)、4 行を追加(文字列・コメント・and・// のコメント)。
  • test/unit/lib/dncl/dncl-number-notation.test.js: 名前の中の全角が半角になること、文字列とコメントは変えないこと。
  • ゴールデン(UPDATE_JA_GOLDEN=1): golden/ja.json の 1 件(ja-906fd1a488)で @x1 → @x1(意図どおり)。

Closes #2266

🤖 Generated with Claude Code

smalruby3-editor-bot Bot and others added 2 commits November 19, 2026 07:54
…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>
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed (stg API): https://preview.smalruby.app/fix-ja-notation-fullwidth-alnum-8536cbf7/

This branch was previously deployed

1 inactive deployment
stg — a3ffede3 Deployed Nov 19, 2026 by smalruby3-editor-bot[bot] via cleanup #442
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