fixed to print a character array
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-08-07 01:24:58 +09:00
parent 2ef2273f11
commit be77ac8ad2
2 changed files with 39 additions and 22 deletions

View File

@ -662,6 +662,22 @@ next:
break; break;
} }
case HCL_BRAND_CHARACTER_ARRAY:
{
hcl_oow_t i;
if (hcl_bfmt_out(hcl, fmtout, opening_parens[HCL_CONCODE_CHARARRAY][json]) <= -1) return -1;
if (HCL_OBJ_GET_SIZE(obj) > 0)
{
if (hcl_bfmt_out(hcl, fmtout, "'%jc'", ((hcl_oop_char_t)obj)->slot[0]) <= -1) return -1;
for (i = 1; i < HCL_OBJ_GET_SIZE(obj); i++)
{
if (hcl_bfmt_out(hcl, fmtout, "%hs'%jc'", breakers[0][json], ((hcl_oop_char_t)obj)->slot[i]) <= -1) return -1;
}
}
if (hcl_bfmt_out(hcl, fmtout, closing_parens[HCL_CONCODE_CHARARRAY][json]) <= -1) return -1;
break;
}
case HCL_BRAND_DIC: case HCL_BRAND_DIC:
{ {
hcl_oow_t bucidx, bucsize, buctally; hcl_oow_t bucidx, bucsize, buctally;

View File

@ -2578,6 +2578,7 @@ static int flx_hmarked_token (hcl_t* hcl, hcl_ooci_t c)
* #include * #include
* #[ ] array * #[ ] array
* #b[ ] byte array * #b[ ] byte array
* #c[ ] character array
* #( ) qlist * #( ) qlist
* #{ } dictionary * #{ } dictionary
* #"..." symbol literal * #"..." symbol literal
@ -2616,7 +2617,7 @@ static int flx_hmarked_token (hcl_t* hcl, hcl_ooci_t c)
case 'B': case 'B':
case 'c': /* character array */ case 'c': /* character array */
case 'C': case 'C':
/* if #b is followed by [, it is a starter for a byte array */ /* #b[ -> byte array, #c[ -> character array */
init_flx_hbc(FLX_HBC(hcl), c); init_flx_hbc(FLX_HBC(hcl), c);
FEED_CONTINUE_WITH_CHAR(hcl, c, HCL_FLX_HMARKED_BC); FEED_CONTINUE_WITH_CHAR(hcl, c, HCL_FLX_HMARKED_BC);
break; break;