diff --git a/lib/main.c b/lib/main.c index 673dbf3..940789a 100644 --- a/lib/main.c +++ b/lib/main.c @@ -1601,10 +1601,10 @@ int main (int argc, char* argv[]) hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot read object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl)); } - break; + if (!xtn->reader_istty) goto oops; + continue; } - if (hcl_print(hcl, obj) <= -1) { hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot print object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl)); @@ -1627,6 +1627,8 @@ int main (int argc, char* argv[]) hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot compile object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl)); } /* carry on? */ + + if (!xtn->reader_istty) goto oops; } else if (xtn->reader_istty) { @@ -1660,7 +1662,11 @@ int main (int argc, char* argv[]) /*hcl_dumpsymtab (hcl);*/ } - hcl_close (hcl); + hcl_close (hcl); return 0; + +oops: + hcl_close (hcl); + return -1; } diff --git a/lib/read.c b/lib/read.c index fcb0363..5053ec1 100644 --- a/lib/read.c +++ b/lib/read.c @@ -1276,6 +1276,7 @@ static HCL_INLINE hcl_oop_t leave_list (hcl_t* hcl, int* flagv, int* oldflagv) /* the stack must not be empty - cannot leave a list without entering it */ HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,hcl->c->r.s)); +/* TODO: fix bug here. unblanced ) cause assertion failure here */ /*head = HCL_CONS_CAR(HCL_CONS_CDR(hcl->c->r.s));*/