added '\n' to is_spacechar()

This commit is contained in:
hyung-hwan 2018-04-24 05:24:58 +00:00
parent 527f48fe80
commit bf030731fd
2 changed files with 5 additions and 2 deletions

View File

@ -154,6 +154,8 @@ static HCL_INLINE int is_spacechar (hcl_bch_t c)
/* TODO: handle other space unicode characters */ /* TODO: handle other space unicode characters */
switch (c) switch (c)
{ {
/* [NOTE]: '\n' is special and used as delimiter. so it's not treated
* as a space character */
case ' ': case ' ':
case '\f': /* formfeed */ case '\f': /* formfeed */
case '\r': /* carriage return */ case '\r': /* carriage return */

View File

@ -134,6 +134,7 @@ static HCL_INLINE int is_spacechar (hcl_bch_t c)
{ {
case ' ': case ' ':
case '\f': /* formfeed */ case '\f': /* formfeed */
case '\n': /* new line */
case '\r': /* carriage return */ case '\r': /* carriage return */
case '\t': /* horizon tab */ case '\t': /* horizon tab */
case '\v': /* vertical tab */ case '\v': /* vertical tab */
@ -637,7 +638,7 @@ static int handle_char_in_array (hcl_json_t* json, hcl_ooci_t c)
} }
else else
{ {
hcl_json_seterrbfmt (json, HCL_EINVAL, "wrong character inside array - %jc", (hcl_ooch_t)c); hcl_json_seterrbfmt (json, HCL_EINVAL, "wrong character inside array - %jc[%d]", (hcl_ooch_t)c, (int)c);
return -1; return -1;
} }
} }
@ -732,7 +733,7 @@ static int handle_char_in_dic (hcl_json_t* json, hcl_ooci_t c)
} }
else else
{ {
hcl_json_seterrbfmt (json, HCL_EINVAL, "wrong character inside array - %jc", (hcl_ooch_t)c); hcl_json_seterrbfmt (json, HCL_EINVAL, "wrong character inside dictionary - %jc[%d]", (hcl_ooch_t)c, (int)c);
return -1; return -1;
} }
} }