changed the notatin of an error literal from #\eNNN to #eNNN.
changed the notation of a smptr literal from #\pXXXX to #pXXXX
This commit is contained in:
parent
e3b5d33811
commit
2c1b4448be
@ -240,11 +240,11 @@ next:
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
case HCL_BRAND_SMPTR:
|
case HCL_BRAND_SMPTR:
|
||||||
if (outbfmt(hcl, mask, "#\\p%zX", (hcl_oow_t)HCL_OOP_TO_SMPTR(obj)) <= -1) return -1;
|
if (outbfmt(hcl, mask, "#p%zX", (hcl_oow_t)HCL_OOP_TO_SMPTR(obj)) <= -1) return -1;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
case HCL_BRAND_ERROR:
|
case HCL_BRAND_ERROR:
|
||||||
if (outbfmt(hcl, mask, "#\\e%zd", (hcl_ooi_t)HCL_OOP_TO_ERROR(obj)) <= -1) return -1;
|
if (outbfmt(hcl, mask, "#e%zd", (hcl_ooi_t)HCL_OOP_TO_ERROR(obj)) <= -1) return -1;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
case HCL_BRAND_CHARACTER:
|
case HCL_BRAND_CHARACTER:
|
||||||
|
44
lib/read.c
44
lib/read.c
@ -735,6 +735,8 @@ static int get_sharp_token (hcl_t* hcl)
|
|||||||
* #bBBBB binary
|
* #bBBBB binary
|
||||||
* #oOOOO octal
|
* #oOOOO octal
|
||||||
* #xXXXX hexadecimal
|
* #xXXXX hexadecimal
|
||||||
|
* #eDDD error
|
||||||
|
* #pHHH smptr
|
||||||
* #nil
|
* #nil
|
||||||
* #true
|
* #true
|
||||||
* #false
|
* #false
|
||||||
@ -743,10 +745,6 @@ static int get_sharp_token (hcl_t* hcl)
|
|||||||
* #\xHHHH unicode character
|
* #\xHHHH unicode character
|
||||||
* #\UHHHH unicode character
|
* #\UHHHH unicode character
|
||||||
* #\uHHHH unicode character
|
* #\uHHHH unicode character
|
||||||
* #\EDDD error
|
|
||||||
* #\eDDD error
|
|
||||||
* #\PHHH smptr
|
|
||||||
* #\pHHH smptr
|
|
||||||
* #( ) array
|
* #( ) array
|
||||||
* #[ ] byte array
|
* #[ ] byte array
|
||||||
* #{ } dictionary
|
* #{ } dictionary
|
||||||
@ -766,6 +764,16 @@ static int get_sharp_token (hcl_t* hcl)
|
|||||||
if (get_radix_number (hcl, c, radix) <= -1) return -1;
|
if (get_radix_number (hcl, c, radix) <= -1) return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'e':
|
||||||
|
if (get_radix_number(hcl, c, 10) <= -1) return -1;
|
||||||
|
SET_TOKEN_TYPE (hcl, HCL_IOTOK_ERRORLIT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
if (get_radix_number(hcl, c, 16) <= -1) return -1;
|
||||||
|
SET_TOKEN_TYPE (hcl, HCL_IOTOK_SMPTRLIT);
|
||||||
|
break;
|
||||||
|
|
||||||
case '\\': /* character literal */
|
case '\\': /* character literal */
|
||||||
ADD_TOKEN_CHAR (hcl, '#');
|
ADD_TOKEN_CHAR (hcl, '#');
|
||||||
ADD_TOKEN_CHAR (hcl, '\\');
|
ADD_TOKEN_CHAR (hcl, '\\');
|
||||||
@ -830,25 +838,6 @@ static int get_sharp_token (hcl_t* hcl)
|
|||||||
goto hexcharlit;
|
goto hexcharlit;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (TOKEN_NAME_CHAR(hcl, 2) == 'P' || TOKEN_NAME_CHAR(hcl, 2) == 'p')
|
|
||||||
{
|
|
||||||
SET_TOKEN_TYPE (hcl, HCL_IOTOK_SMPTRLIT);
|
|
||||||
goto hexcharlit;
|
|
||||||
}
|
|
||||||
else if (TOKEN_NAME_CHAR(hcl, 2) == 'E' || TOKEN_NAME_CHAR(hcl, 2) == 'e')
|
|
||||||
{
|
|
||||||
hcl_oow_t i;
|
|
||||||
for (i = 3; i < TOKEN_NAME_LEN(hcl); i++)
|
|
||||||
{
|
|
||||||
if (!is_digitchar(TOKEN_NAME_CHAR(hcl, i)))
|
|
||||||
{
|
|
||||||
hcl_setsynerrbfmt (hcl, HCL_SYNERR_CHARLIT, TOKEN_LOC(hcl), TOKEN_NAME(hcl),
|
|
||||||
"invalid decimal character in %.*js", TOKEN_NAME_LEN(hcl), TOKEN_NAME_PTR(hcl));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SET_TOKEN_TYPE (hcl, HCL_IOTOK_ERRORLIT);
|
|
||||||
}
|
|
||||||
else if (does_token_name_match(hcl, VOCA_SPACE))
|
else if (does_token_name_match(hcl, VOCA_SPACE))
|
||||||
{
|
{
|
||||||
c = ' ';
|
c = ' ';
|
||||||
@ -2038,8 +2027,8 @@ static int read_object (hcl_t* hcl)
|
|||||||
hcl_oow_t i;
|
hcl_oow_t i;
|
||||||
hcl_oow_t v = 0;
|
hcl_oow_t v = 0;
|
||||||
|
|
||||||
HCL_ASSERT (hcl, TOKEN_NAME_LEN(hcl) >= 4);
|
HCL_ASSERT (hcl, TOKEN_NAME_LEN(hcl) >= 3);
|
||||||
for (i = 3; i < TOKEN_NAME_LEN(hcl); i++)
|
for (i = 2; i < TOKEN_NAME_LEN(hcl); i++)
|
||||||
{
|
{
|
||||||
HCL_ASSERT (hcl, is_xdigitchar(TOKEN_NAME_CHAR(hcl, i)));
|
HCL_ASSERT (hcl, is_xdigitchar(TOKEN_NAME_CHAR(hcl, i)));
|
||||||
v = v * 16 + CHAR_TO_NUM(TOKEN_NAME_CHAR(hcl, i), 16);
|
v = v * 16 + CHAR_TO_NUM(TOKEN_NAME_CHAR(hcl, i), 16);
|
||||||
@ -2051,7 +2040,6 @@ static int read_object (hcl_t* hcl)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
obj = HCL_SMPTR_TO_OOP(v);
|
obj = HCL_SMPTR_TO_OOP(v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2061,8 +2049,8 @@ static int read_object (hcl_t* hcl)
|
|||||||
hcl_oow_t i;
|
hcl_oow_t i;
|
||||||
hcl_ooi_t v = 0;
|
hcl_ooi_t v = 0;
|
||||||
|
|
||||||
HCL_ASSERT (hcl, TOKEN_NAME_LEN(hcl) >= 4);
|
HCL_ASSERT (hcl, TOKEN_NAME_LEN(hcl) >= 3);
|
||||||
for (i = 3; i < TOKEN_NAME_LEN(hcl); i++)
|
for (i = 2; i < TOKEN_NAME_LEN(hcl); i++)
|
||||||
{
|
{
|
||||||
HCL_ASSERT (hcl, is_digitchar(TOKEN_NAME_CHAR(hcl, i)));
|
HCL_ASSERT (hcl, is_digitchar(TOKEN_NAME_CHAR(hcl, i)));
|
||||||
v = v * 10 + CHAR_TO_NUM(TOKEN_NAME_CHAR(hcl, i), 10);
|
v = v * 10 + CHAR_TO_NUM(TOKEN_NAME_CHAR(hcl, i), 10);
|
||||||
|
Loading…
Reference in New Issue
Block a user