bash, nim: fix self-hosted string handling
authorJoel Martin <github@martintribe.org>
Fri, 5 Feb 2016 22:28:07 +0000 (16:28 -0600)
committerJoel Martin <github@martintribe.org>
Fri, 5 Feb 2016 22:28:07 +0000 (16:28 -0600)
bash/core.sh
bash/reader.sh
nim/core.nim

index d8373eb..ffc8dfb 100644 (file)
@@ -98,8 +98,7 @@ prn () {
 println () {
     local res=""
     for x in "${@}"; do _pr_str "${x}"; res="${res} ${r}"; done
-    res="${res//\\n/$'\n'}"
-    echo -e "${res:1}"
+    echo "${res:1}"
     r="${__nil}"; 
 }
 
index 359a6a0..4274032 100644 (file)
@@ -13,9 +13,9 @@ READ_ATOM () {
     case "${token}" in
         [0-9]*) _number "${token}" ;;
         \"*)    token="${token:1:-1}"
-                token="${token//\\\\/\\}"
                 token="${token//\\\"/\"}"
                 token="${token//\\n/$'\n'}"
+                token="${token//\\\\/\\}"
                 _string "${token}" ;;
         :*)     _keyword "${token:1}" ;;
         nil)    r="${__nil}" ;;
index 2d9a316..f7f39a4 100644 (file)
@@ -15,8 +15,7 @@ proc prn(xs: varargs[MalType]): MalType =
   result = nilObj
 
 proc println(xs: varargs[MalType]): MalType =
-  let line = xs.map(proc(x: MalType): string = x.pr_str(false)).join(" ")
-  echo line.replace("\\n", "\n")
+  echo xs.map(proc(x: MalType): string = x.pr_str(false)).join(" ")
   result = nilObj
 
 proc read_str(xs: varargs[MalType]): MalType =