added the semicolon as a token and a delimiter
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d9e658dc4b
commit
984c1f62a9
@ -182,6 +182,7 @@ enum hcl_tok_type_t
|
|||||||
HCL_TOK_DBLCOLONS, /* :: */
|
HCL_TOK_DBLCOLONS, /* :: */
|
||||||
HCL_TOK_TRPCOLONS, /* ::: */
|
HCL_TOK_TRPCOLONS, /* ::: */
|
||||||
HCL_TOK_DCSTAR, /* ::* */
|
HCL_TOK_DCSTAR, /* ::* */
|
||||||
|
HCL_TOK_SEMICOLON, /* ; */
|
||||||
HCL_TOK_COMMA, /* , */
|
HCL_TOK_COMMA, /* , */
|
||||||
HCL_TOK_LPAREN, /* ( */
|
HCL_TOK_LPAREN, /* ( */
|
||||||
HCL_TOK_RPAREN, /* ) */
|
HCL_TOK_RPAREN, /* ) */
|
||||||
|
@ -1917,9 +1917,10 @@ enum hcl_concode_t
|
|||||||
/* these can be set in the SYNCODE flags for a cons cell */
|
/* these can be set in the SYNCODE flags for a cons cell */
|
||||||
HCL_CONCODE_XLIST = 0, /* ( ) - executable list */
|
HCL_CONCODE_XLIST = 0, /* ( ) - executable list */
|
||||||
HCL_CONCODE_MLIST, /* (: ) - message send list */
|
HCL_CONCODE_MLIST, /* (: ) - message send list */
|
||||||
|
HCL_CONCODE_BLOCK, /* { } */
|
||||||
HCL_CONCODE_ARRAY, /* [ ] */
|
HCL_CONCODE_ARRAY, /* [ ] */
|
||||||
HCL_CONCODE_BYTEARRAY, /* #[ ] */
|
HCL_CONCODE_BYTEARRAY, /* #[ ] */
|
||||||
HCL_CONCODE_DIC, /* { } */
|
HCL_CONCODE_DIC, /* #{ } */
|
||||||
HCL_CONCODE_QLIST, /* #( ) - data list */
|
HCL_CONCODE_QLIST, /* #( ) - data list */
|
||||||
HCL_CONCODE_VLIST /* | | - symbol list */
|
HCL_CONCODE_VLIST /* | | - symbol list */
|
||||||
};
|
};
|
||||||
|
@ -219,6 +219,7 @@ int hcl_fmt_object_ (hcl_fmtout_t* fmtout, hcl_oop_t obj)
|
|||||||
/* navtive json */
|
/* navtive json */
|
||||||
{ "(", "(" }, /*HCL_CONCODE_XLIST */
|
{ "(", "(" }, /*HCL_CONCODE_XLIST */
|
||||||
{ "(:", "(" }, /*HCL_CONCODE_MLIST */
|
{ "(:", "(" }, /*HCL_CONCODE_MLIST */
|
||||||
|
{ "{", "{" }, /*HCL_CONCODE_BLOCK */
|
||||||
{ "[", "[" }, /*HCL_CONCODE_ARRAY */
|
{ "[", "[" }, /*HCL_CONCODE_ARRAY */
|
||||||
{ "#[", "[" }, /*HCL_CONCODE_BYTEARRAY */
|
{ "#[", "[" }, /*HCL_CONCODE_BYTEARRAY */
|
||||||
{ "#{", "{" }, /*HCL_CONCODE_DIC */
|
{ "#{", "{" }, /*HCL_CONCODE_DIC */
|
||||||
@ -229,6 +230,7 @@ int hcl_fmt_object_ (hcl_fmtout_t* fmtout, hcl_oop_t obj)
|
|||||||
{
|
{
|
||||||
{ ")", ")" }, /*HCL_CONCODE_XLIST */
|
{ ")", ")" }, /*HCL_CONCODE_XLIST */
|
||||||
{ ")", ")" }, /*HCL_CONCODE_MLIST */
|
{ ")", ")" }, /*HCL_CONCODE_MLIST */
|
||||||
|
{ "}", "}" }, /*HCL_CONCODE_BLOCK */
|
||||||
{ "]", "]" }, /*HCL_CONCODE_ARRAY */
|
{ "]", "]" }, /*HCL_CONCODE_ARRAY */
|
||||||
{ "]", "]" }, /*HCL_CONCODE_BYTEARRAY */
|
{ "]", "]" }, /*HCL_CONCODE_BYTEARRAY */
|
||||||
{ "}", "}" }, /*HCL_CONCODE_DIC */
|
{ "}", "}" }, /*HCL_CONCODE_DIC */
|
||||||
|
13
lib/read.c
13
lib/read.c
@ -324,7 +324,7 @@ static HCL_INLINE int is_alnumchar (hcl_ooci_t c)
|
|||||||
static HCL_INLINE int is_delimchar (hcl_ooci_t c)
|
static HCL_INLINE int is_delimchar (hcl_ooci_t c)
|
||||||
{
|
{
|
||||||
return c == '(' || c == ')' || c == '[' || c == ']' || c == '{' || c == '}' ||
|
return c == '(' || c == ')' || c == '[' || c == ']' || c == '{' || c == '}' ||
|
||||||
c == ';' || c == '|' || c == ',' || c == '.' || c == ':' ||
|
c == ';' || c == '|' || c == ',' || c == '.' || c == ':' || c == ';' ||
|
||||||
/* the first characters of tokens in delim_token_tab up to this point */
|
/* the first characters of tokens in delim_token_tab up to this point */
|
||||||
c == '#' || c == '\"' || c == '\'' || is_spacechar(c) || c == HCL_UCI_EOF;
|
c == '#' || c == '\"' || c == '\'' || is_spacechar(c) || c == HCL_UCI_EOF;
|
||||||
}
|
}
|
||||||
@ -1082,6 +1082,11 @@ static int feed_process_token (hcl_t* hcl)
|
|||||||
LIST_FLAG_SET_CONCODE (frd->flagv, HCL_CONCODE_BYTEARRAY);
|
LIST_FLAG_SET_CONCODE (frd->flagv, HCL_CONCODE_BYTEARRAY);
|
||||||
goto start_list;
|
goto start_list;
|
||||||
|
|
||||||
|
case HCL_TOK_LBRACE: /* { */
|
||||||
|
frd->flagv = DATA_LIST;
|
||||||
|
LIST_FLAG_SET_CONCODE (frd->flagv, HCL_CONCODE_BLOCK);
|
||||||
|
goto start_list;
|
||||||
|
|
||||||
case HCL_TOK_DLPAREN: /* #{ */
|
case HCL_TOK_DLPAREN: /* #{ */
|
||||||
frd->flagv = DATA_LIST;
|
frd->flagv = DATA_LIST;
|
||||||
LIST_FLAG_SET_CONCODE (frd->flagv, HCL_CONCODE_DIC);
|
LIST_FLAG_SET_CONCODE (frd->flagv, HCL_CONCODE_DIC);
|
||||||
@ -1412,7 +1417,7 @@ static delim_token_t delim_token_tab[] =
|
|||||||
* The length must not differ by greater than 1 between 2 items in the same group.
|
* The length must not differ by greater than 1 between 2 items in the same group.
|
||||||
*
|
*
|
||||||
* [NOTE 3]
|
* [NOTE 3]
|
||||||
* don't list #( and #[ here because of overlapping use of # for various purposes.
|
* don't list #(, #[, #{ here because of overlapping use of # for various purposes.
|
||||||
* however, # is included in is_delimchar().
|
* however, # is included in is_delimchar().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1436,7 +1441,9 @@ static delim_token_t delim_token_tab[] =
|
|||||||
{ ":", 1, HCL_TOK_COLON },
|
{ ":", 1, HCL_TOK_COLON },
|
||||||
{ "::", 2, HCL_TOK_DBLCOLONS },
|
{ "::", 2, HCL_TOK_DBLCOLONS },
|
||||||
{ "::*", 3, HCL_TOK_DCSTAR },
|
{ "::*", 3, HCL_TOK_DCSTAR },
|
||||||
{ ":::", 3, HCL_TOK_TRPCOLONS }
|
{ ":::", 3, HCL_TOK_TRPCOLONS },
|
||||||
|
|
||||||
|
{ ";", 1, HCL_TOK_SEMICOLON }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int find_delim_token_char (hcl_t* hcl, const hcl_ooci_t c, int row_start, int row_end, int col, hcl_flx_dt_t* dt)
|
static int find_delim_token_char (hcl_t* hcl, const hcl_ooci_t c, int row_start, int row_end, int col, hcl_flx_dt_t* dt)
|
||||||
|
Loading…
Reference in New Issue
Block a user