changed notation from #{} to #()

This commit is contained in:
hyung-hwan 2018-04-06 14:21:47 +00:00
parent 913883f31a
commit 4ff11f147c
3 changed files with 16 additions and 13 deletions

View File

@ -163,7 +163,7 @@ enum hcl_iotok_type_t
HCL_IOTOK_LPAREN, HCL_IOTOK_LPAREN,
HCL_IOTOK_RPAREN, HCL_IOTOK_RPAREN,
HCL_IOTOK_BAPAREN, /* #[ */ HCL_IOTOK_BAPAREN, /* #[ */
HCL_IOTOK_QLPAREN, /* #{ */ HCL_IOTOK_QLPAREN, /* #( */
HCL_IOTOK_LBRACK, /* [ */ HCL_IOTOK_LBRACK, /* [ */
HCL_IOTOK_RBRACK, /* ] */ HCL_IOTOK_RBRACK, /* ] */
HCL_IOTOK_LBRACE, /* { */ HCL_IOTOK_LBRACE, /* { */

View File

@ -208,7 +208,7 @@ static HCL_INLINE int outfmt_obj (hcl_t* hcl, int mask, hcl_oop_t obj, hcl_outbf
{ "[", "[" }, /*HCL_CONCODE_ARRAY */ { "[", "[" }, /*HCL_CONCODE_ARRAY */
{ "#[", "[" }, /*HCL_CONCODE_BYTEARRAY */ { "#[", "[" }, /*HCL_CONCODE_BYTEARRAY */
{ "{", "{" }, /*HCL_CONCODE_DIC */ { "{", "{" }, /*HCL_CONCODE_DIC */
{ "#{", "[" } /*HCL_CONCODE_QLIST */ { "#(", "[" } /*HCL_CONCODE_QLIST */
}; };
static const hcl_bch_t *closing_parens[][2] = static const hcl_bch_t *closing_parens[][2] =
@ -217,7 +217,7 @@ static HCL_INLINE int outfmt_obj (hcl_t* hcl, int mask, hcl_oop_t obj, hcl_outbf
{ "]", "]" }, /*HCL_CONCODE_ARRAY */ { "]", "]" }, /*HCL_CONCODE_ARRAY */
{ "]", "]" }, /*HCL_CONCODE_BYTEARRAY */ { "]", "]" }, /*HCL_CONCODE_BYTEARRAY */
{ "}", "}" }, /*HCL_CONCODE_DIC */ { "}", "}" }, /*HCL_CONCODE_DIC */
{ "}", "]" } /*HCL_CONCODE_QLIST */ { ")", "]" } /*HCL_CONCODE_QLIST */
}; };
static const hcl_bch_t* breakers[][2] = static const hcl_bch_t* breakers[][2] =

View File

@ -934,7 +934,7 @@ static int get_sharp_token (hcl_t* hcl)
SET_TOKEN_TYPE (hcl, HCL_IOTOK_BAPAREN); SET_TOKEN_TYPE (hcl, HCL_IOTOK_BAPAREN);
break; break;
case '{': /* #{ - qlist opener */ case '(': /* #( - qlist opener */
ADD_TOKEN_CHAR (hcl, '#'); ADD_TOKEN_CHAR (hcl, '#');
ADD_TOKEN_CHAR(hcl, c); ADD_TOKEN_CHAR(hcl, c);
SET_TOKEN_TYPE (hcl, HCL_IOTOK_QLPAREN); SET_TOKEN_TYPE (hcl, HCL_IOTOK_QLPAREN);
@ -1810,7 +1810,7 @@ static int read_object (hcl_t* hcl)
switch (TOKEN_TYPE(hcl)) switch (TOKEN_TYPE(hcl))
{ {
default: default:
hcl_seterrbfmt (hcl, HCL_EINTERN, "invalid token encountered - %d %.*js", hcl_seterrbfmt (hcl, HCL_EINTERN, "invalid token(type %d) encountered - %.*js",
TOKEN_TYPE(hcl), TOKEN_NAME_LEN(hcl), TOKEN_NAME_PTR(hcl)); TOKEN_TYPE(hcl), TOKEN_NAME_LEN(hcl), TOKEN_NAME_PTR(hcl));
return -1; return -1;
@ -1830,25 +1830,28 @@ static int read_object (hcl_t* hcl)
if (begin_include(hcl) <= -1) return -1; if (begin_include(hcl) <= -1) return -1;
goto redo; goto redo;
case HCL_IOTOK_LBRACK: case HCL_IOTOK_LBRACK: /* [] */
flagv = 0;
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_ARRAY); LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_ARRAY);
goto start_list; goto start_list;
case HCL_IOTOK_LBRACE:
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_DIC);
goto start_list;
case HCL_IOTOK_BAPAREN: case HCL_IOTOK_BAPAREN: /* #[] */
flagv = 0; flagv = 0;
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_BYTEARRAY); LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_BYTEARRAY);
goto start_list; goto start_list;
case HCL_IOTOK_LBRACE: /* {} */
flagv = 0;
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_DIC);
goto start_list;
#if 0 #if 0
case HCL_IOTOK_QLBRACK: case HCL_IOTOK_QLPAREN: /* #() */
flagv = 0; flagv = 0;
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_QLIST); LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_QLIST);
goto start_list; goto start_list;
#endif #endif
case HCL_IOTOK_LPAREN: case HCL_IOTOK_LPAREN: /* () */
flagv = 0; flagv = 0;
LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_XLIST); LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_XLIST);
start_list: start_list:
@ -1917,7 +1920,7 @@ static int read_object (hcl_t* hcl)
{ HCL_IOTOK_RBRACK, HCL_SYNERR_RBRACK }, /* ARRAY [] */ { HCL_IOTOK_RBRACK, HCL_SYNERR_RBRACK }, /* ARRAY [] */
{ HCL_IOTOK_RBRACK, HCL_SYNERR_RBRACK }, /* BYTEARRAY #[] */ { HCL_IOTOK_RBRACK, HCL_SYNERR_RBRACK }, /* BYTEARRAY #[] */
{ HCL_IOTOK_RBRACE, HCL_SYNERR_RBRACE }, /* DIC {} */ { HCL_IOTOK_RBRACE, HCL_SYNERR_RBRACE }, /* DIC {} */
{ HCL_IOTOK_RBRACE, HCL_SYNERR_RBRACE } /* QLIST ${} */ { HCL_IOTOK_RPAREN, HCL_SYNERR_RPAREN } /* QLIST $() */
}; };
int oldflagv; int oldflagv;