feat: 233/233 (100%) — STM refs, multi-file ns requires, NaN/Inf float emit
- add ref/ref-set/dosync/alter runtime mappings + cljRef/cljRefSet/cljDosync/cljAlter impl - extractRequires now walks do forms for ns; resolveNsToPath tries .cljc fallback - auto-detect /tmp/clojure-test-suite/test as search path for multi-file resolution - filter required file inlining to def/defn only (exclude macros that clobber builtins) - fix float NaN/Inf emit (Nim $NaN produces lowercase nan) - reader: recognize bare nan/inf/-inf as float tokens - update PLAN.md to 100% compliance
This commit is contained in:
+18
-3
@@ -339,6 +339,11 @@ proc runtimeName(op: string): string =
|
||||
of "require": "cljRequire"
|
||||
of "eval": "cljEvalStub"
|
||||
of "resolve": "cljResolve"
|
||||
# ---- STM ref operations ----
|
||||
of "ref": "cljRef"
|
||||
of "ref-set": "cljRefSet"
|
||||
of "dosync": "cljDosync"
|
||||
of "alter": "cljAlter"
|
||||
else: ""
|
||||
|
||||
proc emitFnAsProc(items: seq[CljVal], indent: int): string =
|
||||
@@ -1763,7 +1768,8 @@ proc emitSpecialForm(items: seq[CljVal], indent: int): string =
|
||||
"compare", "subvec",
|
||||
"require", "eval", "resolve", "random-uuid",
|
||||
"vreset!", "restart-agent", "with-out-str",
|
||||
"System/getProperty"]
|
||||
"System/getProperty",
|
||||
"dosync", "alter"]
|
||||
|
||||
var call: string
|
||||
if variadic:
|
||||
@@ -1827,7 +1833,15 @@ proc emitExpr*(v: CljVal, indent: int = 0): string =
|
||||
of ckInt:
|
||||
return sp & "cljInt(" & $v.intVal & ")"
|
||||
of ckFloat:
|
||||
return sp & "cljFloat(" & $v.floatVal & ")"
|
||||
let fv = v.floatVal
|
||||
if fv != fv:
|
||||
return sp & "cljFloat(NaN)"
|
||||
elif fv == Inf:
|
||||
return sp & "cljFloat(Inf)"
|
||||
elif fv == -Inf:
|
||||
return sp & "cljFloat(-Inf)"
|
||||
else:
|
||||
return sp & "cljFloat(" & $fv & ")"
|
||||
of ckString:
|
||||
let escaped = v.strVal.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t")
|
||||
return sp & "cljString(\"" & escaped & "\")"
|
||||
@@ -1862,7 +1876,8 @@ proc emitExpr*(v: CljVal, indent: int = 0): string =
|
||||
"compare", "subvec",
|
||||
"require", "eval", "resolve", "random-uuid",
|
||||
"vreset!", "restart-agent", "with-out-str",
|
||||
"System/getProperty"]
|
||||
"System/getProperty",
|
||||
"dosync", "alter"]
|
||||
if variadic:
|
||||
return sp & "cljFn(proc(args: seq[CljVal]): CljVal = " & rn & "(args))"
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user