From 4ff11f147c958b70c022ce3602a5a2f744b5b161 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 6 Apr 2018 14:21:47 +0000 Subject: [PATCH] changed notation from #{} to #() --- lib/hcl-prv.h | 2 +- lib/print.c | 4 ++-- lib/read.c | 23 +++++++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/hcl-prv.h b/lib/hcl-prv.h index 55b2a10..3cabab2 100644 --- a/lib/hcl-prv.h +++ b/lib/hcl-prv.h @@ -163,7 +163,7 @@ enum hcl_iotok_type_t HCL_IOTOK_LPAREN, HCL_IOTOK_RPAREN, HCL_IOTOK_BAPAREN, /* #[ */ - HCL_IOTOK_QLPAREN, /* #{ */ + HCL_IOTOK_QLPAREN, /* #( */ HCL_IOTOK_LBRACK, /* [ */ HCL_IOTOK_RBRACK, /* ] */ HCL_IOTOK_LBRACE, /* { */ diff --git a/lib/print.c b/lib/print.c index ba59934..5de5292 100644 --- a/lib/print.c +++ b/lib/print.c @@ -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_BYTEARRAY */ { "{", "{" }, /*HCL_CONCODE_DIC */ - { "#{", "[" } /*HCL_CONCODE_QLIST */ + { "#(", "[" } /*HCL_CONCODE_QLIST */ }; 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_BYTEARRAY */ { "}", "}" }, /*HCL_CONCODE_DIC */ - { "}", "]" } /*HCL_CONCODE_QLIST */ + { ")", "]" } /*HCL_CONCODE_QLIST */ }; static const hcl_bch_t* breakers[][2] = diff --git a/lib/read.c b/lib/read.c index 2ee19fc..79ebcec 100644 --- a/lib/read.c +++ b/lib/read.c @@ -934,7 +934,7 @@ static int get_sharp_token (hcl_t* hcl) SET_TOKEN_TYPE (hcl, HCL_IOTOK_BAPAREN); break; - case '{': /* #{ - qlist opener */ + case '(': /* #( - qlist opener */ ADD_TOKEN_CHAR (hcl, '#'); ADD_TOKEN_CHAR(hcl, c); SET_TOKEN_TYPE (hcl, HCL_IOTOK_QLPAREN); @@ -1810,7 +1810,7 @@ static int read_object (hcl_t* hcl) switch (TOKEN_TYPE(hcl)) { 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)); return -1; @@ -1830,25 +1830,28 @@ static int read_object (hcl_t* hcl) if (begin_include(hcl) <= -1) return -1; goto redo; - case HCL_IOTOK_LBRACK: + case HCL_IOTOK_LBRACK: /* [] */ + flagv = 0; LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_ARRAY); 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; LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_BYTEARRAY); goto start_list; + case HCL_IOTOK_LBRACE: /* {} */ + flagv = 0; + LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_DIC); + goto start_list; + #if 0 - case HCL_IOTOK_QLBRACK: + case HCL_IOTOK_QLPAREN: /* #() */ flagv = 0; LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_QLIST); goto start_list; #endif - case HCL_IOTOK_LPAREN: + case HCL_IOTOK_LPAREN: /* () */ flagv = 0; LIST_FLAG_SET_CONCODE (flagv, HCL_CONCODE_XLIST); 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 }, /* BYTEARRAY #[] */ { HCL_IOTOK_RBRACE, HCL_SYNERR_RBRACE }, /* DIC {} */ - { HCL_IOTOK_RBRACE, HCL_SYNERR_RBRACE } /* QLIST ${} */ + { HCL_IOTOK_RPAREN, HCL_SYNERR_RPAREN } /* QLIST $() */ }; int oldflagv;