This commit is contained in:
parent
7409f9a2a3
commit
a60bcfef80
@ -2,7 +2,7 @@ package hcl
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
#include <hcl.h>
|
#include <hcl.h>
|
||||||
#include <hcl-utl.h>
|
#include <hcl-str.h>
|
||||||
#include <stdlib.h> // for C.free
|
#include <stdlib.h> // for C.free
|
||||||
|
|
||||||
extern int hcl_go_cci_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg);
|
extern int hcl_go_cci_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg);
|
||||||
|
12
lib/read.c
12
lib/read.c
@ -885,15 +885,17 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
|
|||||||
|
|
||||||
HCL_ASSERT (hcl, hcl->c->r.st != HCL_NULL);
|
HCL_ASSERT (hcl, hcl->c->r.st != HCL_NULL);
|
||||||
rstl = hcl->c->r.st;
|
rstl = hcl->c->r.st;
|
||||||
|
cc = (hcl_concode_t)LIST_FLAG_GET_CONCODE(rstl->flagv);
|
||||||
|
|
||||||
if (rstl->count <= 0) return 0; /* not allowed at the list beginning */
|
if (rstl->count <= 0) return 0; /* not allowed at the list beginning */
|
||||||
|
|
||||||
/* mark the state that a colon has appeared in the list */
|
/* mark the state that a colon has appeared in the list */
|
||||||
/*if (HCL_CNODE_IS_TYPED(HCL_CNODE_CONS_CAR(rstl->head), HCL_CNODE_CLASS))*/
|
if (cc == HCL_CONCODE_XLIST && HCL_CNODE_IS_FOR_LANG(HCL_CNODE_CONS_CAR(rstl->head)))
|
||||||
if (HCL_CNODE_IS_FOR_LANG(HCL_CNODE_CONS_CAR(rstl->head)))
|
|
||||||
{
|
{
|
||||||
/* class :superclassame ...
|
/* allow a colon if the first element is 'class', 'fun', or some other keywords:
|
||||||
* class name:superclassname ... */
|
* class :superclassame ...
|
||||||
|
* class name:superclassname ...
|
||||||
|
* fun X:abc ... */
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,7 +943,6 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
|
|||||||
/* multiple single-colons - e.g. #{ "abc": : 20 } */
|
/* multiple single-colons - e.g. #{ "abc": : 20 } */
|
||||||
if (rstl->flagv & (COMMAED | COLONED | COLONEQED | BINOPED)) return 0;
|
if (rstl->flagv & (COMMAED | COLONED | COLONEQED | BINOPED)) return 0;
|
||||||
|
|
||||||
cc = (hcl_concode_t)LIST_FLAG_GET_CONCODE(rstl->flagv);
|
|
||||||
if (cc == HCL_CONCODE_XLIST)
|
if (cc == HCL_CONCODE_XLIST)
|
||||||
{
|
{
|
||||||
hcl_cnode_t* tmp;
|
hcl_cnode_t* tmp;
|
||||||
@ -967,6 +968,7 @@ static HCL_INLINE int can_colon_list (hcl_t* hcl)
|
|||||||
}
|
}
|
||||||
else if (cc != HCL_CONCODE_DIC) return 0; /* no allowed if not in a dictionary */
|
else if (cc != HCL_CONCODE_DIC) return 0; /* no allowed if not in a dictionary */
|
||||||
|
|
||||||
|
/* dictionary */
|
||||||
if (!(rstl->count & 1)) return 0; /* not allwed after the value in a dictionary */
|
if (!(rstl->count & 1)) return 0; /* not allwed after the value in a dictionary */
|
||||||
|
|
||||||
/* mark that it's coloned. this is to be cleared when clear_comma_colon_binop_flag() is called */
|
/* mark that it's coloned. this is to be cleared when clear_comma_colon_binop_flag() is called */
|
||||||
|
Loading…
Reference in New Issue
Block a user