aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/printer.json
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-15 16:34:55 -0600
committerJoel Martin <github@martintribe.org>2015-02-15 16:34:55 -0600
commitc5d302358e0b519f9de6d570158d07d60fda6d97 (patch)
tree4705f31f4485a1b9501a08dac5728beef08a352c /miniMAL/printer.json
parent7ebf5219e1be21ed10cecabda8262c77da7465ae (diff)
downloadmal-c5d302358e0b519f9de6d570158d07d60fda6d97.tar.gz
mal-c5d302358e0b519f9de6d570158d07d60fda6d97.zip
miniMAL: step4.
Diffstat (limited to 'miniMAL/printer.json')
-rw-r--r--miniMAL/printer.json17
1 files changed, 15 insertions, 2 deletions
diff --git a/miniMAL/printer.json b/miniMAL/printer.json
index 99f4198..8029413 100644
--- a/miniMAL/printer.json
+++ b/miniMAL/printer.json
@@ -8,9 +8,18 @@
["`", "join"], ["`", " "]],
["`", ")"]],
["if", ["=", ["`", "string"], ["type", "exp"]],
- ["str", ["`", "\""], "exp", ["`", "\""]],
+ ["if", "print_readably",
+ ["str", ["`", "\""],
+ [".",
+ [".",
+ [".", "exp",
+ ["`", "replace"], ["RegExp", ["`", "\\\\"], ["`", "g"]], ["`", "\\\\"]],
+ ["`", "replace"], ["RegExp", ["`", "\""], ["`", "g"]], ["`", "\\\""]],
+ ["`", "replace"], ["RegExp", ["`", "\n"], ["`", "g"]], ["`", "\\n"]],
+ ["`", "\""]],
+ "exp"],
["if", ["=", ["`", "number"], ["type", "exp"]],
- "exp",
+ "exp",
["if", ["=", null, "exp"],
["`", "nil"],
["if", ["=", true, "exp"],
@@ -21,5 +30,9 @@
["get", "exp", ["`", "val"]],
["str", ["`", "#<unknown: "], "exp", ["`", ">"]]]]]]]]]]],
+["def", "pr-list", ["fn", ["lst", "print_readably", "sep"],
+ [".", ["map", ["fn", ["s"], ["pr-str", "s", "print_readably"]], "lst"],
+ ["`", "join"], "sep"]]],
+
null
]