ongoing work to support 0x, 0o, 0b
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-22 22:04:18 +09:00
parent 261970a1a4
commit 8a277c77c0
4 changed files with 30 additions and 55 deletions

View File

@ -4740,22 +4740,22 @@ static hcl_oop_t string_to_num (hcl_t* hcl, hcl_oocs_t* str, const hcl_loc_t* lo
#else
if (radixed)
{
/* #xFF80, #b1111 */
/* 0xFF80, 0b1111 */
HCL_ASSERT (hcl, ptr < end);
if (*ptr != '#')
if (/**ptr != '#' &&*/ *ptr != '0')
{
hcl_setsynerrbfmt(hcl, HCL_SYNERR_RADIX, loc, str, "radixed number not starting with #");
return HCL_NULL;
}
ptr++; /* skip '#' */
ptr++; /* skip '0' */
if (*ptr == 'x') base = 16;
else if (*ptr == 'o') base = 8;
else if (*ptr == 'b') base = 2;
else
{
hcl_setsynerrbfmt (hcl, HCL_SYNERR_RADIX, loc, str, "invalid radix specifier %c", *ptr);
hcl_setsynerrbfmt (hcl, HCL_SYNERR_RADIX, loc, HCL_NULL, "invalid radix specifier %c in %js", *ptr, str);
return HCL_NULL;
}
ptr++;