removed HCL_CNODE_IS_SYMBOL_PLAIN. renamed HCL_CNODE_IS_SYMBOL_PLAIN_BINOP to HCL_CNODE_IS_SYMBOL_BINOP. renamed HCL_CNODE_IS_SYMBOL_PLAIN_IDENT to HCL_CNODE_IS_SYMBOL_IDENT
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6896da6870
commit
f4d223f646
32
lib/comp.c
32
lib/comp.c
@ -1444,7 +1444,7 @@ static int collect_vardcl_for_class (hcl_t* hcl, hcl_cnode_t* obj, hcl_cnode_t**
|
||||
goto next;
|
||||
}
|
||||
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN(var) || HCL_CNODE_IS_SYMBOL_PLAIN_BINOP(var)) goto synerr_varname;
|
||||
if (!HCL_CNODE_IS_SYMBOL(var) || HCL_CNODE_IS_SYMBOL_BINOP(var)) goto synerr_varname;
|
||||
|
||||
checkpoint = hcl->c->tv.s.len;
|
||||
n = add_temporary_variable(hcl, HCL_CNODE_GET_TOK(var), tv_slen_saved);
|
||||
@ -1525,7 +1525,7 @@ static int collect_vardcl (hcl_t* hcl, hcl_cnode_t* obj, hcl_cnode_t** nextobj,
|
||||
{
|
||||
var = HCL_CNODE_CONS_CAR(dcl);
|
||||
#if 0
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN(var))
|
||||
if (!HCL_CNODE_IS_SYMBOL(var))
|
||||
{
|
||||
hcl_setsynerrbfmt (
|
||||
hcl, HCL_SYNERR_ARGNAME, HCL_CNODE_GET_LOC(var), HCL_NULL,
|
||||
@ -1535,7 +1535,7 @@ static int collect_vardcl (hcl_t* hcl, hcl_cnode_t* obj, hcl_cnode_t** nextobj,
|
||||
}
|
||||
#else
|
||||
/* the above checks are not needed as the reader guarantees the followings */
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL_PLAIN(var));
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL(var));
|
||||
#endif
|
||||
|
||||
if (add_temporary_variable(hcl, HCL_CNODE_GET_TOK(var), tv_dup_check_start) <= -1)
|
||||
@ -2514,7 +2514,7 @@ static int compile_class (hcl_t* hcl, hcl_cnode_t* src)
|
||||
tmp = HCL_CNODE_CONS_CAR(obj);
|
||||
if (HCL_CNODE_IS_FOR_DATA_SIMPLE(tmp) || HCL_CNODE_IS_FOR_LANG(tmp))
|
||||
{
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN_IDENT(tmp))
|
||||
if (!HCL_CNODE_IS_SYMBOL_IDENT(tmp))
|
||||
{
|
||||
hcl_setsynerrbfmt (
|
||||
hcl, HCL_SYNERR_VARNAME, HCL_CNODE_GET_LOC(tmp), HCL_NULL,
|
||||
@ -2565,7 +2565,7 @@ static int compile_class (hcl_t* hcl, hcl_cnode_t* src)
|
||||
|
||||
/* superclass part */
|
||||
superclass = HCL_CNODE_CONS_CAR(obj);
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN(superclass))
|
||||
if (!HCL_CNODE_IS_SYMBOL(superclass))
|
||||
{
|
||||
if (HCL_CNODE_IS_FOR_DATA_SIMPLE(superclass) || HCL_CNODE_IS_FOR_LANG(superclass))
|
||||
{
|
||||
@ -2942,7 +2942,7 @@ static int compile_fun (hcl_t* hcl, hcl_cnode_t* src)
|
||||
*/
|
||||
|
||||
tmp = HCL_CNODE_CONS_CAR(next);
|
||||
if (HCL_CNODE_IS_SYMBOL_PLAIN(tmp))
|
||||
if (HCL_CNODE_IS_SYMBOL(tmp))
|
||||
{
|
||||
/* 'fun' followed by name */
|
||||
fun_got_name:
|
||||
@ -2979,7 +2979,7 @@ static int compile_fun (hcl_t* hcl, hcl_cnode_t* src)
|
||||
}
|
||||
|
||||
tmp = HCL_CNODE_CONS_CAR(next);
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN(tmp))
|
||||
if (!HCL_CNODE_IS_SYMBOL(tmp))
|
||||
{
|
||||
hcl_setsynerrbfmt (
|
||||
hcl, HCL_SYNERR_FUN, HCL_CNODE_GET_LOC(tmp), HCL_NULL,
|
||||
@ -3057,7 +3057,7 @@ static int compile_fun (hcl_t* hcl, hcl_cnode_t* src)
|
||||
}
|
||||
|
||||
tmp = HCL_CNODE_CONS_CAR(next);
|
||||
if (HCL_CNODE_IS_SYMBOL_PLAIN(tmp))
|
||||
if (HCL_CNODE_IS_SYMBOL(tmp))
|
||||
{
|
||||
/* it is attribute list for sure. fun(#attr..) name */
|
||||
attr_list = arg_list;
|
||||
@ -3207,7 +3207,7 @@ static int compile_fun (hcl_t* hcl, hcl_cnode_t* src)
|
||||
|
||||
if (in_ret_args)
|
||||
{
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN_IDENT(arg))
|
||||
if (!HCL_CNODE_IS_SYMBOL_IDENT(arg))
|
||||
{
|
||||
/* in 'fun x (x :: 20) { }', '20' is not a valid return variable name.
|
||||
* in 'fun x (x :: if) { }', 'if' is not a valid return variable name. */
|
||||
@ -3262,7 +3262,7 @@ static int compile_fun (hcl_t* hcl, hcl_cnode_t* src)
|
||||
{
|
||||
va = 1;
|
||||
}
|
||||
else if (!HCL_CNODE_IS_SYMBOL_PLAIN_IDENT(arg))
|
||||
else if (!HCL_CNODE_IS_SYMBOL_IDENT(arg))
|
||||
{
|
||||
hcl_setsynerrbfmt (
|
||||
hcl, HCL_SYNERR_ARGNAME, HCL_CNODE_GET_LOC(arg), HCL_NULL,
|
||||
@ -3584,7 +3584,7 @@ static int compile_set_r (hcl_t* hcl, hcl_cnode_t* src)
|
||||
do
|
||||
{
|
||||
var = HCL_CNODE_CONS_CAR(obj);
|
||||
if (!HCL_CNODE_IS_SYMBOL(var)) /* TODO: should this be HCL_CNODE_IS_SYMBOL_PLAIN(var)?? */
|
||||
if (!HCL_CNODE_IS_SYMBOL(var)) /* TODO: should this be HCL_CNODE_IS_SYMBOL(var)?? */
|
||||
{
|
||||
if (nvars > 0) break;
|
||||
hcl_setsynerrbfmt (hcl, HCL_SYNERR_VARNAME, HCL_CNODE_GET_LOC(var), HCL_CNODE_GET_TOK(var), "variable name not symbol in %.*js", HCL_CNODE_GET_TOKLEN(cmd), HCL_CNODE_GET_TOKPTR(cmd));
|
||||
@ -3809,7 +3809,7 @@ static HCL_INLINE int compile_catch (hcl_t* hcl)
|
||||
}
|
||||
|
||||
exarg = HCL_CNODE_CONS_CAR(exarg);
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN(exarg))
|
||||
if (!HCL_CNODE_IS_SYMBOL(exarg))
|
||||
{
|
||||
hcl_setsynerrbfmt (
|
||||
hcl, HCL_SYNERR_VARNAME, HCL_CNODE_GET_LOC(exarg), HCL_NULL,
|
||||
@ -4117,7 +4117,7 @@ static int compile_cons_alist_expression (hcl_t* hcl, hcl_cnode_t* cmd)
|
||||
var = HCL_CNODE_CONS_CAR(cmd);
|
||||
obj = HCL_CNODE_CONS_CDR(cmd);
|
||||
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL_PLAIN(var) || HCL_CNODE_IS_DSYMBOL_CLA(var) || HCL_CNODE_IS_CONS_CONCODED(var, HCL_CONCODE_TUPLE));
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL(var) || HCL_CNODE_IS_DSYMBOL_CLA(var) || HCL_CNODE_IS_CONS_CONCODED(var, HCL_CONCODE_TUPLE));
|
||||
HCL_ASSERT (hcl, obj && HCL_CNODE_IS_CONS(obj)); /* reader guaranteed */
|
||||
|
||||
val = HCL_CNODE_CONS_CAR(obj);
|
||||
@ -4142,7 +4142,7 @@ static int compile_cons_alist_expression (hcl_t* hcl, hcl_cnode_t* cmd)
|
||||
|
||||
var = HCL_CNODE_CONS_CAR(obj);
|
||||
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL_PLAIN(var) || HCL_CNODE_IS_DSYMBOL_CLA(var)); /* reader guaranteed */
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL(var) || HCL_CNODE_IS_DSYMBOL_CLA(var)); /* reader guaranteed */
|
||||
|
||||
x = find_variable_backward_with_token(hcl, var, &vi);
|
||||
if (x <= -1) return -1;
|
||||
@ -4470,7 +4470,7 @@ static int compile_cons_mlist_expression (hcl_t* hcl, hcl_cnode_t* obj, int nret
|
||||
return -1;
|
||||
}
|
||||
car = HCL_CNODE_CONS_CAR(cdr);
|
||||
if (HCL_CNODE_IS_SYMBOL_PLAIN(car))
|
||||
if (HCL_CNODE_IS_SYMBOL(car))
|
||||
{
|
||||
PUSH_CFRAME (hcl, COP_EMIT_PUSH_SYMBOL, car);
|
||||
}
|
||||
@ -6067,7 +6067,7 @@ static HCL_INLINE int post_fun (hcl_t* hcl)
|
||||
hcl_var_info_t vi;
|
||||
int x;
|
||||
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL_PLAIN(fun_name));
|
||||
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL(fun_name));
|
||||
|
||||
if (is_in_class_init_scope(hcl))
|
||||
{
|
||||
|
@ -474,9 +474,8 @@ typedef enum hcl_cnode_flag_t hcl_cnode_flag_t;
|
||||
#define HCL_CNODE_IS_COLONLT(x) ((x)->cn_type == HCL_CNODE_COLONLT)
|
||||
|
||||
#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)
|
||||
#define HCL_CNODE_IS_SYMBOL_PLAIN_IDENT(x) (HCL_CNODE_IS_SYMBOL_PLAIN(x) && !hcl_is_binop_char((x)->cn_tok.ptr[0]))
|
||||
#define HCL_CNODE_IS_SYMBOL_PLAIN_BINOP(x) (HCL_CNODE_IS_SYMBOL_PLAIN(x) && hcl_is_binop_char((x)->cn_tok.ptr[0]))
|
||||
#define HCL_CNODE_IS_SYMBOL_IDENT(x) (HCL_CNODE_IS_SYMBOL(x) && !hcl_is_binop_char((x)->cn_tok.ptr[0]))
|
||||
#define HCL_CNODE_IS_SYMBOL_BINOP(x) (HCL_CNODE_IS_SYMBOL(x) && hcl_is_binop_char((x)->cn_tok.ptr[0]))
|
||||
|
||||
#define HCL_CNODE_IS_DSYMBOL(x) ((x)->cn_type == HCL_CNODE_DSYMBOL)
|
||||
#define HCL_CNODE_IS_DSYMBOL_CLA(x) ((x)->cn_type == HCL_CNODE_DSYMBOL && (x)->u.dsymbol.is_cla)
|
||||
|
10
lib/read.c
10
lib/read.c
@ -284,7 +284,7 @@ static HCL_INLINE int is_delim_char (hcl_ooci_t c)
|
||||
}
|
||||
|
||||
|
||||
int hcl_is_binop_char (hcl_ooci_t c) /* not static HCL_INLINE for shared use with comp.c via HCL_CNODE_IS_SYMBOL_PLAIN() */
|
||||
int hcl_is_binop_char (hcl_ooci_t c) /* not static HCL_INLINE for shared use with comp.c via HCL_CNODE_IS_SYMBOL() */
|
||||
{
|
||||
return c == '&' || c == '*' || c == '+' || c == '-' || c == '/' || c == '%' ||
|
||||
c == '<' || c == '>' || c == '=' || c == '@' || c == '|' || c == '~';
|
||||
@ -689,7 +689,7 @@ static HCL_INLINE hcl_cnode_t* leave_list (hcl_t* hcl, hcl_loc_t* list_loc, int*
|
||||
/* check in advance if the array members are all plain symbols */
|
||||
hcl_cnode_t* lcar;
|
||||
lcar = HCL_CNODE_CONS_CAR(tmp);
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN_IDENT(lcar) && !HCL_CNODE_IS_DSYMBOL_CLA(lcar))
|
||||
if (!HCL_CNODE_IS_SYMBOL_IDENT(lcar) && !HCL_CNODE_IS_DSYMBOL_CLA(lcar))
|
||||
{
|
||||
hcl_setsynerrbfmt (hcl, HCL_SYNERR_LVALUE, HCL_CNODE_GET_LOC(lval), HCL_CNODE_GET_TOK(lval), "bad lvalue - invalid element in tuple");
|
||||
goto oops;
|
||||
@ -715,7 +715,7 @@ static HCL_INLINE hcl_cnode_t* leave_list (hcl_t* hcl, hcl_loc_t* list_loc, int*
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!HCL_CNODE_IS_SYMBOL_PLAIN_IDENT(lval) && !HCL_CNODE_IS_DSYMBOL_CLA(lval))
|
||||
if (!HCL_CNODE_IS_SYMBOL_IDENT(lval) && !HCL_CNODE_IS_DSYMBOL_CLA(lval))
|
||||
{
|
||||
hcl_setsynerrbfmt (hcl, HCL_SYNERR_LVALUE, HCL_CNODE_GET_LOC(lval), HCL_CNODE_GET_TOK(lval), "bad lvalue - invalid element");
|
||||
goto oops;
|
||||
@ -918,7 +918,7 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
|
||||
if (rstl->count == 2)
|
||||
{
|
||||
/* fun class:name() *... */
|
||||
if (HCL_CNODE_IS_SYMBOL_PLAIN(tmp)) return 2;
|
||||
if (HCL_CNODE_IS_SYMBOL(tmp)) return 2;
|
||||
}
|
||||
else if (rstl->count == 3)
|
||||
{
|
||||
@ -929,7 +929,7 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
|
||||
next = HCL_CNODE_CONS_CDR(next);
|
||||
HCL_ASSERT (hcl, next != HCL_NULL);
|
||||
tmp = HCL_CNODE_CONS_CAR(next); /* third item */
|
||||
if (HCL_CNODE_IS_SYMBOL_PLAIN(tmp)) return 2;
|
||||
if (HCL_CNODE_IS_SYMBOL(tmp)) return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user