Files
hakorune/apps/tests/esc_dirname_smoke.nyash
Selfhosting Dev 658a0d46da feat(llvm-py): Major breakthrough in Python LLVM backend! 🎉
 Print and FileBox paths now working correctly
 Resolver simplified by removing overly aggressive fast-path optimization
 Both OFF/ON in compare_harness_on_off.sh now use Python version
 String handle propagation issues resolved

Key changes:
- Removed instruction reordering in llvm_builder.py (respecting MIR order)
- Resolver now more conservative but reliable
- compare_harness_on_off.sh updated to use Python backend for both paths

This marks a major milestone towards Phase 15 self-hosting with Python/llvmlite!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 00:44:28 +09:00

38 lines
872 B
Plaintext

// esc_dirname_smoke.nyash — minimal smoke for esc_json/dirname and println
static box Main {
esc_json(s) {
// very small escaper: replace \ and "
local out = ""
local i = 0
local n = s.length()
loop(i < n) {
local ch = s.substring(i, i+1)
if ch == "\\" { out = out + "\\\\" } else {
if ch == "\"" { out = out + "\\\"" } else { out = out + ch }
}
i = i + 1
}
return out
}
dirname(path) {
// simple pure string dirname: lastIndexOf('/')
local i = path.lastIndexOf("/")
if i < 0 { return "." }
return path.substring(0, i)
}
main(args) {
local console = new ConsoleBox()
// Test escaping (A\"B\\C)
local t1 = me.esc_json("A\\\"B\\\\C")
console.println(t1)
// Test dirname
local t2 = me.dirname("dir1/dir2/file.txt")
console.println(t2)
return 0
}
}