refactor(mir): Phase 137-6-S2 - dev-only で canonicalizer decision を提案として受け取る
## 目的 Canonicalizer の decision を router に差し込む(既定挙動不変) ## 変更内容 ### choose_pattern_kind() に parity check 統合 - dev-only 時に Canonicalizer を呼び出し - router_choice と canonical_choice を比較 - 不一致時の動作: - strict mode (`HAKO_JOINIR_STRICT=1`): panic (Fail-Fast) - debug mode (`NYASH_JOINIR_DEV=1`): ログのみ - 既定挙動: router_choice を維持(Canonicalizer は提案のみ) ### ログ出力 ``` [choose_pattern_kind/PARITY] OK: canonical and actual agree on Pattern2Break ``` ## 効果 - ✅ Canonicalizer → Router の parity check 統合 - ✅ SSOT 入口での一致性検証 - ✅ 既定挙動完全不変(フラグOFF時) - ✅ 新 env 追加なし(既存の `joinir_dev_enabled()` と `strict_enabled()` を使用) ## テスト結果 - ✅ `cargo build --release`: 成功 - ✅ skip_whitespace: parity green ``` NYASH_JOINIR_DEV=1 HAKO_JOINIR_STRICT=1 ./target/release/hakorune \ tools/selfhost/test_pattern3_skip_whitespace.hako → [choose_pattern_kind/PARITY] OK ``` - ✅ スモークテスト(simple_*): 5/5 PASS - ✅ 退行なし 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -36,37 +36,15 @@ pub static OPERATORS_DIV_RULES: &[(&str, &str, &str, &str)] = &[
|
||||
];
|
||||
pub fn lookup_keyword(word: &str) -> Option<&'static str> {
|
||||
for (k, t) in KEYWORDS {
|
||||
if *k == word { return Some(*t); }
|
||||
if *k == word {
|
||||
return Some(*t);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub static SYNTAX_ALLOWED_STATEMENTS: &[&str] = &[
|
||||
"box",
|
||||
"global",
|
||||
"function",
|
||||
"static",
|
||||
"if",
|
||||
"loop",
|
||||
"break",
|
||||
"return",
|
||||
"print",
|
||||
"nowait",
|
||||
"include",
|
||||
"local",
|
||||
"outbox",
|
||||
"try",
|
||||
"throw",
|
||||
"using",
|
||||
"from",
|
||||
"box", "global", "function", "static", "if", "loop", "break", "return", "print", "nowait",
|
||||
"include", "local", "outbox", "try", "throw", "using", "from",
|
||||
];
|
||||
pub static SYNTAX_ALLOWED_BINOPS: &[&str] = &[
|
||||
"add",
|
||||
"sub",
|
||||
"mul",
|
||||
"div",
|
||||
"and",
|
||||
"or",
|
||||
"eq",
|
||||
"ne",
|
||||
];
|
||||
pub static SYNTAX_ALLOWED_BINOPS: &[&str] = &["add", "sub", "mul", "div", "and", "or", "eq", "ne"];
|
||||
|
||||
Reference in New Issue
Block a user