smokes: add JSON nested/invalid cases; force VM backend; temp nyash.toml with json_native package for resolution

This commit is contained in:
Selfhosting Dev
2025-09-26 00:38:14 +09:00
parent 6ce06501e1
commit b3a96faccb
30 changed files with 135 additions and 295 deletions

View File

@ -32,53 +32,5 @@ pub fn log_prelude_body_seam(prelude_clean: &str, body: &str, seam_dbg: bool) {
eprintln!("[using][seam] body_head =<<<{}>>>", head.replace('\n', "\\n"));
}
/// Apply optional seam safety: append missing '}' for unmatched '{' in prelude
/// When `trace` is true, emits a short note with delta count.
pub fn fix_prelude_braces_if_enabled(prelude_clean: &str, combined: &mut String, trace: bool) {
if !crate::config::env::resolve_fix_braces() {
return;
}
// compute { } delta ignoring strings and comments
let mut delta: i32 = 0;
let mut it = prelude_clean.chars().peekable();
let mut in_str = false;
let mut in_sl = false;
let mut in_ml = false;
while let Some(c) = it.next() {
if in_sl {
if c == '\n' { in_sl = false; }
continue;
}
if in_ml {
if c == '*' {
if let Some('/') = it.peek().copied() {
it.next();
in_ml = false;
}
}
continue;
}
if in_str {
if c == '\\' { it.next(); continue; }
if c == '"' { in_str = false; }
continue;
}
if c == '"' { in_str = true; continue; }
if c == '/' {
match it.peek().copied() {
Some('/') => { in_sl = true; it.next(); continue; }
Some('*') => { in_ml = true; it.next(); continue; }
_ => {}
}
}
if c == '{' { delta += 1; }
if c == '}' { delta -= 1; }
}
if delta > 0 {
if trace { eprintln!("[using][seam] fix: appending {} '}}' before body", delta); }
for _ in 0..delta {
combined.push('}');
combined.push('\n');
}
}
}
// Legacy brace fix function removed (Phase 15 cleanup)
// AST-based integration handles syntax errors properly without text-level hacks

View File

@ -12,7 +12,7 @@ impl NyashRunner {
Ok(s) => s,
Err(e) => { eprintln!("❌ Error reading file {}: {}", filename, e); process::exit(1); }
};
// Using preprocessing (legacy inline or AST-prelude merge when NYASH_USING_AST=1)
// Using preprocessing with AST-prelude merge (when NYASH_USING_AST=1)
let mut code2 = code;
let use_ast_prelude = crate::config::env::enable_using()
&& crate::config::env::using_ast_enabled();