From 506b8fd9d72d6a2caa43fedf60ee8f54fbbd7b6a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 2 Oct 2024 00:41:54 +0900 Subject: [PATCH] removed the :* token --- lib/cnode.c | 5 ----- lib/comp.c | 5 +++-- lib/hcl-prv.h | 10 +++------- lib/print.c | 1 - lib/read.c | 5 ----- t/call-5001.err | 4 ++-- t/feed-5001.err | 4 ++-- 7 files changed, 10 insertions(+), 24 deletions(-) diff --git a/lib/cnode.c b/lib/cnode.c index 7efe202..958aa3f 100644 --- a/lib/cnode.c +++ b/lib/cnode.c @@ -106,11 +106,6 @@ hcl_cnode_t* hcl_makecnodecolonlt (hcl_t* hcl, int flags, const hcl_loc_t* loc, return hcl_makecnode(hcl, HCL_CNODE_COLONLT, flags, loc, tok); } -hcl_cnode_t* hcl_makecnodecolonstar (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok) -{ - return hcl_makecnode(hcl, HCL_CNODE_COLONSTAR, flags, loc, tok); -} - hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_ooch_t v) { hcl_cnode_t* c = hcl_makecnode(hcl, HCL_CNODE_CHARLIT, flags, loc, tok); diff --git a/lib/comp.c b/lib/comp.c index 18da41e..d61417e 100644 --- a/lib/comp.c +++ b/lib/comp.c @@ -5282,12 +5282,13 @@ redo: case HCL_CNODE_COLON: case HCL_CNODE_COLONLT: case HCL_CNODE_COLONGT: - case HCL_CNODE_COLONSTAR: default: /* hcl_setsynerrbfmt (hcl, HCL_SYNERR_INTERN, HCL_CNODE_GET_LOC(oprnd), HCL_CNODE_GET_TOK(oprnd), "internal error - unexpected object type %d", HCL_CNODE_GET_TYPE(oprnd)); */ - hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNED, HCL_CNODE_GET_LOC(oprnd), HCL_CNODE_GET_TOK(oprnd), "prohibited in this context", HCL_CNODE_GET_TYPE(oprnd)); + hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNED, HCL_CNODE_GET_LOC(oprnd), HCL_NULL, + "'%.*js' prohibited in this context", + HCL_CNODE_GET_TOKLEN(oprnd), HCL_CNODE_GET_TOKPTR(oprnd)); return -1; } diff --git a/lib/hcl-prv.h b/lib/hcl-prv.h index b83a2a6..a424a29 100644 --- a/lib/hcl-prv.h +++ b/lib/hcl-prv.h @@ -331,7 +331,6 @@ enum hcl_tok_type_t HCL_TOK_COLONEQ, /* := */ HCL_TOK_COLONGT, /* :+ */ HCL_TOK_COLONLT, /* :+ */ - HCL_TOK_COLONSTAR, /* :* */ HCL_TOK_SEMICOLON, /* ; */ HCL_TOK_COMMA, /* , */ HCL_TOK_LPAREN, /* ( */ @@ -426,13 +425,12 @@ enum hcl_cnode_type_t HCL_CNODE_RETURN, HCL_CNODE_REVERT, - HCL_CNODE_ELLIPSIS, - HCL_CNODE_TRPCOLONS, + HCL_CNODE_ELLIPSIS, /* ... */ + HCL_CNODE_TRPCOLONS, /* ::: */ HCL_CNODE_DBLCOLONS, /* :: */ HCL_CNODE_COLON, /* : */ HCL_CNODE_COLONGT, /* :> */ - HCL_CNODE_COLONLT, /* :< */ - HCL_CNODE_COLONSTAR, /* :* */ + HCL_CNODE_COLONLT /* :< */ }; typedef enum hcl_cnode_type_t hcl_cnode_type_t; @@ -458,7 +456,6 @@ typedef enum hcl_cnode_flag_t hcl_cnode_flag_t; #define HCL_CNODE_IS_COLON(x) ((x)->cn_type == HCL_CNODE_COLON) #define HCL_CNODE_IS_COLONGT(x) ((x)->cn_type == HCL_CNODE_COLONGT) #define HCL_CNODE_IS_COLONLT(x) ((x)->cn_type == HCL_CNODE_COLONLT) -#define HCL_CNODE_IS_COLONSTAR(x) ((x)->cn_type == HCL_CNODE_COLONSTAR) #define HCL_CNODE_IS_SYMBOL(x) ((x)->cn_type == HCL_CNODE_SYMBOL) #define HCL_CNODE_IS_SYMBOL_PLAIN(x) ((x)->cn_type == HCL_CNODE_SYMBOL && (x)->u.symbol.syncode == 0) @@ -2012,7 +2009,6 @@ hcl_cnode_t* hcl_makecnodedblcolons (hcl_t* hcl, int flags, const hcl_loc_t* loc hcl_cnode_t* hcl_makecnodecolon (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodecolongt (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodecolonlt (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); -hcl_cnode_t* hcl_makecnodecolonstar (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_ooch_t v); hcl_cnode_t* hcl_makecnodebchrlit (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_oob_t v); hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); diff --git a/lib/print.c b/lib/print.c index 1547cb6..19cce10 100644 --- a/lib/print.c +++ b/lib/print.c @@ -945,7 +945,6 @@ void hcl_dumpcnode (hcl_t* hcl, hcl_cnode_t* cnode, int newline) case HCL_CNODE_COLON: case HCL_CNODE_COLONGT: case HCL_CNODE_COLONLT: - case HCL_CNODE_COLONSTAR: hcl_logbfmt (hcl, HCL_LOG_FATAL, " %.*js ", HCL_CNODE_GET_TOKLEN(cnode), HCL_CNODE_GET_TOKPTR(cnode)); break; diff --git a/lib/read.c b/lib/read.c index 8bbb2aa..12dd7ef 100644 --- a/lib/read.c +++ b/lib/read.c @@ -1887,10 +1887,6 @@ static int feed_process_token (hcl_t* hcl) frd->obj = hcl_makecnodecolonlt(hcl, 0, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); goto auto_xlist; - case HCL_TOK_COLONSTAR: - frd->obj = hcl_makecnodecolonstar(hcl, 0, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); - goto auto_xlist; - case HCL_TOK_SMPTRLIT: { hcl_oow_t i; @@ -2114,7 +2110,6 @@ static delim_token_t delim_token_tab[] = { ":=", 2, HCL_TOK_COLONEQ }, /* assignment */ { ":>", 2, HCL_TOK_COLONGT }, { ":<", 2, HCL_TOK_COLONLT }, - { ":*", 2, HCL_TOK_COLONSTAR }, /* class instantiation method */ { "::", 2, HCL_TOK_DBLCOLONS }, /* superclass, class variables, class methods */ { ":::", 3, HCL_TOK_TRPCOLONS }, diff --git a/t/call-5001.err b/t/call-5001.err index 6229ee1..f413ec9 100644 --- a/t/call-5001.err +++ b/t/call-5001.err @@ -27,11 +27,11 @@ if (< 2 3) {} elif true else ##ERROR: syntax error - block expression expected --- -if else ##ERROR: syntax error - prohibited in this context - else +if else ##ERROR: syntax error - 'else' prohibited in this context --- -if elif else ##ERROR: syntax error - prohibited in this context - elif +if elif else ##ERROR: syntax error - 'elif' prohibited in this context --- diff --git a/t/feed-5001.err b/t/feed-5001.err index 1685032..f75ad4a 100644 --- a/t/feed-5001.err +++ b/t/feed-5001.err @@ -130,7 +130,7 @@ printf "%O\n" 35rabcdefghijklzabcd ##ERROR: syntax error - invalid numeric lite --- -printf :*; ##ERROR: syntax error - prohibited in this context +printf if; ##ERROR: syntax error - 'if' prohibited in this context --- @@ -140,7 +140,7 @@ fun :: fun1() { ##ERROR: syntax error - invalid function name '::' for 'fun' --- -fun :* fun1() { ##ERROR: syntax error - invalid function name ':*' for 'fun' +fun fun fun1() { ##ERROR: syntax error - invalid function name 'fun' for 'fun' return 10; };