diff options
-rw-r--r-- | 017parse_tree.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/017parse_tree.cc b/017parse_tree.cc index 50499a7c..6d84f898 100644 --- a/017parse_tree.cc +++ b/017parse_tree.cc @@ -79,6 +79,7 @@ string_tree* parse_string_tree(istream& in) { } in.get(); // skip ')' assert(*curr == NULL); + if (result == NULL) return result; if (result->right == NULL) return result; // standardize the final element to always be on the right if it's an atom // (a b c) => (a b . c) in s-expression parlance @@ -106,6 +107,12 @@ container bar [ ] +parse: product: {1: ("foo" ("address" "array" "character") ("bar" "number"))} +:(scenario dilated_empty_tree) +def main [ + {1: number, foo: ()} <- copy 34 +] ++parse: product: {1: "number", "foo": ()} + :(scenario dilated_singleton_tree) def main [ {1: number, foo: (bar)} <- copy 34 |