From e0083b44533bdf5d16b373db720afc2bce816535 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 17 Apr 2024 14:33:24 +0900 Subject: [PATCH] changed the binop check in the reader code --- lib/read.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/read.c b/lib/read.c index 5bc400d..8343127 100644 --- a/lib/read.c +++ b/lib/read.c @@ -1473,8 +1473,16 @@ static int feed_process_token (hcl_t* hcl) case HCL_TOK_BINOP: { int can = 0; - if (frd->level <= 0 || !(can = can_binop_list(hcl))) + if (frd->level <= 0) { + HCL_ASSERT (hcl, hcl->c->r.st == HCL_NULL); + /*if (hcl->c->r.st) goto banned_binop;*/ + /* very first even before entering a list including an auto-forged list */ + can = 1; + } + else if (!(can = can_binop_list(hcl))) + { + banned_binop: hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl), "prohibited binary operator"); goto oops; }