diff --git a/lib/cnode.c b/lib/cnode.c index d5bcbdb..f46aaa8 100644 --- a/lib/cnode.c +++ b/lib/cnode.c @@ -86,9 +86,14 @@ hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, int flags, const hcl_loc_t* loc return make_cnode(hcl, HCL_CNODE_TRPCOLONS, flags, loc, tok); } -hcl_cnode_t* hcl_makecnodecolonplus (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok) +hcl_cnode_t* hcl_makecnodecolongt (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok) { - return make_cnode(hcl, HCL_CNODE_COLONPLUS, flags, loc, tok); + return make_cnode(hcl, HCL_CNODE_COLONGT, flags, loc, tok); +} + +hcl_cnode_t* hcl_makecnodecolonlt (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok) +{ + return make_cnode(hcl, HCL_CNODE_COLONLT, flags, loc, tok); } hcl_cnode_t* hcl_makecnodecolonstar (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok) diff --git a/lib/hcl-prv.h b/lib/hcl-prv.h index fb06fe7..371081e 100644 --- a/lib/hcl-prv.h +++ b/lib/hcl-prv.h @@ -188,7 +188,8 @@ enum hcl_tok_type_t HCL_TOK_DBLCOLONS, /* :: */ HCL_TOK_TRPCOLONS, /* ::: */ HCL_TOK_COLONEQ, /* := */ - HCL_TOK_COLONPLUS, /* :+ */ + HCL_TOK_COLONGT, /* :+ */ + HCL_TOK_COLONLT, /* :+ */ HCL_TOK_COLONSTAR, /* :* */ HCL_TOK_SEMICOLON, /* ; */ HCL_TOK_COMMA, /* , */ @@ -257,7 +258,8 @@ enum hcl_cnode_type_t HCL_CNODE_SUPER, HCL_CNODE_ELLIPSIS, HCL_CNODE_TRPCOLONS, - HCL_CNODE_COLONPLUS, /* :+ */ + HCL_CNODE_COLONGT, /* :> */ + HCL_CNODE_COLONLT, /* :< */ HCL_CNODE_COLONSTAR, /* :* */ HCL_CNODE_CONS, @@ -281,7 +283,8 @@ typedef enum hcl_cnode_flagt hcl_cnode_flag_t; #define HCL_CNODE_IS_ELLIPSIS(x) ((x)->cn_type == HCL_CNODE_ELLIPSIS) #define HCL_CNODE_IS_TRPCOLONS(x) ((x)->cn_type == HCL_CNODE_TRPCOLONS) -#define HCL_CNODE_IS_COLONPLUS(x) ((x)->cn_type == HCL_CNODE_COLONPLUS) +#define HCL_CNODE_IS_COLONGT(x) ((x)->cn_type == HCL_CNODE_COLONGT) +#define HCL_CNODE_IS_COLONLT(x) ((x)->cn_type == HCL_CNODE_COLONLT) #define HCL_CNODE_IS_COLONSTAR(x) ((x)->cn_type == HCL_CNODE_COLONSTAR) #define HCL_CNODE_IS_SYMBOL(x) ((x)->cn_type == HCL_CNODE_SYMBOL) @@ -1780,7 +1783,8 @@ hcl_cnode_t* hcl_makecnodeself (hcl_t* hcl, int flags, const hcl_loc_t* loc, con hcl_cnode_t* hcl_makecnodesuper (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodeellipsis (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); -hcl_cnode_t* hcl_makecnodecolonplus (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); +hcl_cnode_t* hcl_makecnodecolongt (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); +hcl_cnode_t* hcl_makecnodecolonlt (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodecolonstar (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok); hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_ooch_t v); hcl_cnode_t* hcl_makecnodebchrlit (hcl_t* hcl, int flags, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_oob_t v); diff --git a/lib/print.c b/lib/print.c index 787c582..d20f171 100644 --- a/lib/print.c +++ b/lib/print.c @@ -817,8 +817,9 @@ void hcl_dumpcnode (hcl_t* hcl, hcl_cnode_t* cnode, int newline) case HCL_CNODE_SUPER: case HCL_CNODE_ELLIPSIS: case HCL_CNODE_TRPCOLONS: + case HCL_CNODE_COLONGT: + case HCL_CNODE_COLONLT: case HCL_CNODE_COLONSTAR: - case HCL_CNODE_COLONPLUS: hcl_logbfmt (hcl, HCL_LOG_FATAL, " %.*js ", HCL_CNODE_GET_TOKLEN(cnode), HCL_CNODE_GET_TOKPTR(cnode)); break; diff --git a/lib/read.c b/lib/read.c index cf4be6c..56c0d3f 100644 --- a/lib/read.c +++ b/lib/read.c @@ -1432,8 +1432,12 @@ static int feed_process_token (hcl_t* hcl) frd->obj = hcl_makecnodetrpcolons(hcl, 0, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); goto auto_xlist; - case HCL_TOK_COLONPLUS: - frd->obj = hcl_makecnodecolonplus(hcl, 0, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); + case HCL_TOK_COLONGT: + frd->obj = hcl_makecnodecolongt(hcl, 0, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); + goto auto_xlist; + + case HCL_TOK_COLONLT: + frd->obj = hcl_makecnodecolonlt(hcl, 0, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); goto auto_xlist; case HCL_TOK_COLONSTAR: @@ -1656,7 +1660,8 @@ static delim_token_t delim_token_tab[] = { ":", 1, HCL_TOK_COLON }, /* key-value separator in dictionary */ { ":=", 2, HCL_TOK_COLONEQ }, /* assignment */ - { ":+", 2, HCL_TOK_COLONPLUS }, + { ":>", 2, HCL_TOK_COLONGT }, + { ":<", 2, HCL_TOK_COLONLT }, { ":*", 2, HCL_TOK_COLONSTAR }, /* class instantiation method */ { "::", 2, HCL_TOK_DBLCOLONS }, { ":::", 3, HCL_TOK_TRPCOLONS }, /* superclass, class variables, class methods */