aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/printer.json
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-16 00:33:30 -0600
committerJoel Martin <github@martintribe.org>2015-02-16 00:33:30 -0600
commit320455465294f170f54cda772142f4de4cb6f602 (patch)
tree43c99b1539f192954f1f7ff18fed2b132c191431 /miniMAL/printer.json
parentd90c784472f6131f28612eb6eaa02404e002178d (diff)
downloadmal-320455465294f170f54cda772142f4de4cb6f602.tar.gz
mal-320455465294f170f54cda772142f4de4cb6f602.zip
miniMAL: keyword, vector and hash-map support.
Diffstat (limited to 'miniMAL/printer.json')
-rw-r--r--miniMAL/printer.json38
1 files changed, 28 insertions, 10 deletions
diff --git a/miniMAL/printer.json b/miniMAL/printer.json
index df2ac82..273d80a 100644
--- a/miniMAL/printer.json
+++ b/miniMAL/printer.json
@@ -7,17 +7,35 @@
[".", ["map", ["fn", ["x"], ["pr-str", "x", "print_readably"]], "exp"],
["`", "join"], ["`", " "]],
["`", ")"]],
+ ["if", ["vector?", "exp"],
+ ["str",
+ ["`", "["],
+ [".", ["map", ["fn", ["x"], ["pr-str", "x", "print_readably"]], "exp"],
+ ["`", "join"], ["`", " "]],
+ ["`", "]"]],
+ ["if", ["map?", "exp"],
+ ["str",
+ ["`", "{"],
+ [".", ["map", ["fn", ["k"],
+ ["str", ["pr-str", "k", "print_readably"],
+ ["`", " "],
+ ["pr-str", ["get", "exp", "k"], "print_readably"]]],
+ ["keys", "exp"]],
+ ["`", "join"], ["`", " "]],
+ ["`", "}"]],
["if", ["=", ["`", "string"], ["type", "exp"]],
- ["if", "print_readably",
- ["str", ["`", "\""],
- [".",
+ ["if", ["=", ["`", "\u029e"], ["get", "exp", 0]],
+ ["str", ["`", ":"], ["slice", "exp", 1]],
+ ["if", "print_readably",
+ ["str", ["`", "\""],
[".",
- [".", "exp",
- ["`", "replace"], ["RegExp", ["`", "\\\\"], ["`", "g"]], ["`", "\\\\"]],
- ["`", "replace"], ["RegExp", ["`", "\""], ["`", "g"]], ["`", "\\\""]],
- ["`", "replace"], ["RegExp", ["`", "\n"], ["`", "g"]], ["`", "\\n"]],
- ["`", "\""]],
- "exp"],
+ [".",
+ [".", "exp",
+ ["`", "replace"], ["RegExp", ["`", "\\\\"], ["`", "g"]], ["`", "\\\\"]],
+ ["`", "replace"], ["RegExp", ["`", "\""], ["`", "g"]], ["`", "\\\""]],
+ ["`", "replace"], ["RegExp", ["`", "\n"], ["`", "g"]], ["`", "\\n"]],
+ ["`", "\""]],
+ "exp"]],
["if", ["=", ["`", "number"], ["type", "exp"]],
"exp",
["if", ["=", null, "exp"],
@@ -34,7 +52,7 @@
["`", " "],
["pr-str", ["get", "exp", ["`", "ast"]]],
["`", ")"]],
- ["str", ["`", "#<unknown: "], "exp", ["`", ">"]]]]]]]]]]]],
+ ["str", ["`", "#<unknown: "], "exp", ["`", ">"]]]]]]]]]]]]]],
["def", "pr-list", ["fn", ["lst", "print_readably", "sep"],
[".", ["map", ["fn", ["s"], ["pr-str", "s", "print_readably"]], "lst"],