hv1: early-exit at main (no plugin init); tokenizer: Stage-3 single-quote + full escapes (\/ \b \f \' \r fix); builder: route BinOp via SSOT emit_binop_to_dst; hv1 verify canary route (builder→Core); docs: phase-20.39 updates

This commit is contained in:
nyash-codex
2025-11-04 20:46:43 +09:00
parent 31ce798341
commit 44a5158a14
53 changed files with 2237 additions and 179 deletions

View File

@ -15,7 +15,7 @@
use super::NyashRunner;
use std::io::Write;
pub(crate) fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
pub fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
// Optional: direct Core Dispatcher via child nyash (boxed)
// Toggle: HAKO_CORE_DIRECT=1 (alias: NYASH_CORE_DIRECT)
let core_direct = std::env::var("HAKO_CORE_DIRECT").ok().as_deref() == Some("1")
@ -39,6 +39,26 @@ pub(crate) fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
}
let mut payload = json.to_string();
// Fast-path: accept MIR(JSON v0) directly when it looks like a module (functions/blocks)
if payload.contains("\"functions\"") && payload.contains("\"blocks\"") {
match super::mir_json_v0::parse_mir_v0_to_module(&payload) {
Ok(module) => {
super::json_v0_bridge::maybe_dump_mir(&module);
crate::runner::child_env::pre_run_reset_oob_if_strict();
let rc = runner.execute_mir_module_quiet_exit(&module);
if crate::config::env::oob_strict_fail() && crate::runtime::observe::oob_seen() {
eprintln!("[gate-c][oob-strict] Out-of-bounds observed → exit(1)");
return 1;
}
return rc;
}
Err(e) => {
eprintln!("❌ MIR JSON v0 parse error: {}", e);
return 1;
}
}
}
// Always try the v1 bridge first (StageB Program JSON → MIR module).
// This is noop when input is already MIR(JSON v0) with functions/blocks.
if let Ok(j) = crate::runner::modes::common_util::core_bridge::canonicalize_module_json(&payload) {