adding code to support class attribute list. work in progress
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-05 00:05:52 +09:00
parent f4d223f646
commit 3f350dd38a
8 changed files with 190 additions and 43 deletions

View File

@ -893,7 +893,8 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
if (rstl->count <= 0) return 0; /* not allowed at the list beginning */
/* mark the state that a colon has appeared in the list */
if (HCL_CNODE_IS_TYPED(HCL_CNODE_CONS_CAR(rstl->head), HCL_CNODE_CLASS))
/*if (HCL_CNODE_IS_TYPED(HCL_CNODE_CONS_CAR(rstl->head), HCL_CNODE_CLASS))*/
if (HCL_CNODE_IS_FOR_LANG(HCL_CNODE_CONS_CAR(rstl->head)))
{
/* class :superclassame ...
* class name:superclassname ... */
@ -903,6 +904,9 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
if (rstl->count == 1) rstl->flagv |= JSON; /* mark that the first key is colon-delimited */
else if (!(rstl->flagv & JSON))
{
#if 0
/* this strict check is not needed as it returns 2 above if the first element is a language keyword element */
/* handling of a colon sign in out-of-class instance method definition.
* e.g. fun String:length() { return (str.length self). }
* TODO: inject a symbol ':' to differentiate form '::' or ':*' methods.
@ -933,6 +937,7 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
}
}
}
#endif
return 0; /* the first key is not colon-delimited. so not allowed to colon-delimit other keys */
}