From 87196c341506ea140a1b88b74f1bb24b609d9e78 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 5 Nov 2016 22:40:22 -0700 Subject: 3628 - fix a segfault in parsing Thanks Jack Couch for accidentally leading me to this bug. --- html/017parse_tree.cc.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'html') diff --git a/html/017parse_tree.cc.html b/html/017parse_tree.cc.html index 98f55374..f700033e 100644 --- a/html/017parse_tree.cc.html +++ b/html/017parse_tree.cc.html @@ -115,10 +115,11 @@ string_tree* parse_string_tree(istream& in} in.get(); // skip ')' assert(*curr == NULL); + 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 string_tree* tmp = result; - while (tmp->right && tmp->right->right) tmp = tmp->right; + while (tmp->right->right) tmp = tmp->right; assert(!tmp->right->atom); if (!tmp->right->left->atom) return result; string_tree* tmp2 = tmp->right; @@ -140,6 +141,12 @@ string_tree* parse_string_tree(istream& incontainer bar [ ] +parse: product: {1: ("foo" ("address" "array" "character") ("bar" "number"))} + +:(scenario dilated_singleton_tree) +def main [ + {1: number, foo: (bar)} <- copy 34 +] ++parse: product: {1: "number", "foo": ("bar")} -- cgit 1.4.1-2-gfad0