docs: Fix peek/match documentation inconsistencies

- Update CLAUDE.md: peek式 → match式, peek構文 → match構文
- Update LANGUAGE_REFERENCE_2025.md: Peek式 → Match式
- Fix default pattern: else → _ (underscore)
- Resolve confusion causing JSON development Claude to use incorrect syntax

This fixes the root cause where new AI developers were referencing outdated
'peek' syntax examples and getting parse errors, forcing them to rewrite
with 'if' statements instead of using the correct 'match' syntax.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-23 02:03:48 +09:00
parent fdc889ed58
commit 0d443dd6fa
2 changed files with 10 additions and 10 deletions

View File

@ -196,14 +196,14 @@ loop() { } # 無条件ループは `loop(true){}` を意図明確
> 設計メモ: Nyashは「単一入口・先頭条件」の制御フロー規律を重視するため、dowhileは採用しません。必ず実行の表現は `loop(1)` ラッパーや `repeat/until` 糖衣からゼロコストで正規化します。
```
#### **PeekPhase 12.7で追加)**
#### **MatchPhase 12.7で追加)**
```nyash
# パターンマッチング風の分岐
local result = match value {
"A" => 100,
"B" => 200,
"C" => 300,
else => 0 # else必須
_ => 0 # _はデフォルトパターン
}
# 文の形式も可
@ -215,7 +215,7 @@ match status {
"success" => {
print("All good")
},
else => {
_ => {
print("Unknown status")
}
}