parser(match): add MVP type patterns (IntegerBox(x)/StringBox(s)) via AST If-chain; keep literal-only path using PeekExpr; add smoke app (apps/tests/match_type_pattern_basic.nyash); build + stage-2 smokes green

This commit is contained in:
Selfhosting Dev
2025-09-19 08:34:29 +09:00
parent f4e340da08
commit 9142476484
348 changed files with 2539 additions and 281 deletions

View File

@ -51,6 +51,15 @@ Special notes
- `Var("me")`: Bridge 既定では未定義エラー。デバッグ用に `NYASH_BRIDGE_ME_DUMMY=1` でダミー `NewBox{class}` を注入可(`NYASH_BRIDGE_ME_CLASS` 省略時は `Main`)。
- `--ny-parser-pipe` は stdin の JSON v0 を受け取り、MIR→MIRInterp 経由で実行する。
Unified Members (Phase15)
- Sourcelevel unified members (stored/computed/once/birth_once) are lowered before JSON emission into regular slots/methods; JSON v0 remains unchanged.
- Lowering conventions:
- stored → slot (initializer becomes a onetime evaluation in construction path)
- computed → synthetic getter method; field read becomes method call
- once → synthetic getter + hidden `Option<T>` slot with firstread initialization; uncaught exception on first read poisons the property and rethrows on subsequent reads
- birth_once → hidden slot initialized before user `birth` body in declaration order; uncaught exception aborts construction
- method postfix `catch/cleanup` lower to try/catch/finally when Stage3 is enabled; when disabled, bodies execute without handlers
CLI/Env cheatsheet
- Pipe: `echo '{...}' | target/release/nyash --ny-parser-pipe`
- File: `target/release/nyash --json-file sample.json`