diff --git a/moo/lib/comp.c b/moo/lib/comp.c index 783b860..54b73ea 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -988,7 +988,7 @@ not_comment: return 0; unterminated: - hcl_setsynerr (moo, MOO_SYNERR_CMTNC, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_CMTNC, LEXER_LOC(moo), MOO_NULL); return -1; } @@ -1025,7 +1025,7 @@ static int get_ident (moo_t* moo, moo_ooci_t char_read_ahead) if (!is_digitchar(c)) { ADD_TOKEN_CHAR (moo, c); - hcl_setsynerr (moo, MOO_SYNERR_ERRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_ERRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -1038,7 +1038,7 @@ static int get_ident (moo_t* moo, moo_ooci_t char_read_ahead) if (c != ')') { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, LEXER_LOC(moo), MOO_NULL); return -1; } @@ -1073,7 +1073,7 @@ static int get_ident (moo_t* moo, moo_ooci_t char_read_ahead) else { /* the last character is not a colon */ - hcl_setsynerr (moo, MOO_SYNERR_COLON, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_COLON, LEXER_LOC(moo), MOO_NULL); return -1; } } @@ -1276,7 +1276,7 @@ static int get_numlit (moo_t* moo, int negated) if (radix < 2 || radix > 36) { /* no digit after the radix specifier */ - hcl_setsynerr (moo, MOO_SYNERR_RADIXINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RADIXINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -1286,7 +1286,7 @@ static int get_numlit (moo_t* moo, int negated) if (CHAR_TO_NUM(c, radix) >= radix) { /* no digit after the radix specifier */ - hcl_setsynerr (moo, MOO_SYNERR_RADNUMLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RADNUMLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -1331,7 +1331,7 @@ static int get_charlit (moo_t* moo) moo_ooci_t c = moo->c->lxc.c; /* even a new-line or white space would be taken */ if (c == MOO_OOCI_EOF) { - hcl_setsynerr (moo, MOO_SYNERR_CLTNT, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_CLTNT, LEXER_LOC(moo), MOO_NULL); return -1; } @@ -1369,7 +1369,7 @@ static int get_strlit (moo_t* moo) if (c == MOO_OOCI_EOF) { /* string not closed */ - hcl_setsynerr (moo, MOO_SYNERR_STRNC, TOKEN_LOC(moo) /*&moo->c->lxc.l*/, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_STRNC, TOKEN_LOC(moo) /*&moo->c->lxc.l*/, MOO_NULL); return -1; } } @@ -1405,7 +1405,7 @@ static int get_string (moo_t* moo, moo_ooch_t end_char, moo_ooch_t esc_char, int if (c == MOO_OOCI_EOF) { - hcl_setsynerr (moo, MOO_SYNERR_STRNC, TOKEN_LOC(moo) /*&moo->c->lxc.l*/, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_STRNC, TOKEN_LOC(moo) /*&moo->c->lxc.l*/, MOO_NULL); return -1; } @@ -1729,7 +1729,7 @@ retry: switch (c) { case MOO_OOCI_EOF: - hcl_setsynerr (moo, MOO_SYNERR_HLTNT, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_HLTNT, LEXER_LOC(moo), MOO_NULL); return -1; case '(': @@ -1799,7 +1799,7 @@ retry: /* if a colon is found in the middle of a symbol, * the last charater is expected to be a colon as well. * but, the last character is not a colon */ - hcl_setsynerr (moo, MOO_SYNERR_COLON, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_COLON, LEXER_LOC(moo), MOO_NULL); return -1; } } @@ -1845,7 +1845,7 @@ retry: } else { - hcl_setsynerr (moo, MOO_SYNERR_HLTNT, LEXER_LOC(moo), MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_HLTNT, LEXER_LOC(moo), MOO_NULL); return -1; } @@ -1877,7 +1877,7 @@ retry: { if (moo->c->tok.name.len != 1) { - hcl_setsynerr (moo, MOO_SYNERR_CHARLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_CHARLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } SET_TOKEN_TYPE (moo, MOO_IOTOK_CHARLIT); @@ -1929,7 +1929,7 @@ retry: else { moo->c->ilchr = (moo_ooch_t)c; - hcl_setsynerr (moo, MOO_SYNERR_ILCHR, LEXER_LOC(moo), &moo->c->ilchr_ucs); + moo_setsynerr (moo, MOO_SYNERR_ILCHR, LEXER_LOC(moo), &moo->c->ilchr_ucs); return -1; } break; @@ -1998,7 +1998,7 @@ static int begin_include (moo_t* moo) if (moo->c->impl (moo, MOO_IO_OPEN, arg) <= -1) { - hcl_setsynerr (moo, MOO_SYNERR_INCLUDE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_INCLUDE, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -2006,7 +2006,7 @@ static int begin_include (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD) { /* check if a period is following the includee name */ - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -2364,7 +2364,7 @@ static int patch_long_forward_jump_instruction (moo_t* moo, moo_oow_t jip, moo_o if (code_size > MAX_CODE_JUMP * 2) { /* TODO: change error code or get it as a parameter */ - hcl_setsynerr (moo, MOO_SYNERR_BLKFLOOD, errloc, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_BLKFLOOD, errloc, MOO_NULL); return -1; } @@ -2668,7 +2668,7 @@ static MOO_INLINE int add_class_level_variable (moo_t* moo, var_type_t var_type, if (moo->c->cls.var[var_type].total_count >= varlim[var_type]) { - hcl_setsynerrbfmt (moo, MOO_SYNERR_VARFLOOD, loc, name, "too many "); + moo_setsynerrbfmt (moo, MOO_SYNERR_VARFLOOD, loc, name, "too many "); return -1; } @@ -3135,7 +3135,7 @@ static int preprocess_dotted_name (moo_t* moo, int flags, moo_oop_nsdic_t topdic wrong_name: seg.len += seg.ptr - fqn->ptr; seg.ptr = fqn->ptr; - hcl_setsynerr (moo, MOO_SYNERR_NAMESPACEINVAL, fqn_loc, &seg); + moo_setsynerr (moo, MOO_SYNERR_NAMESPACEINVAL, fqn_loc, &seg); return -1; } @@ -3162,7 +3162,7 @@ static int resolve_pooldic (moo_t* moo, int dotted, const moo_oocs_t* name) ass = moo_lookupdic (moo, (moo_oop_dic_t)ns_oop, &last); if (!ass || MOO_CLASSOF(moo, ass->value) != moo->_pool_dictionary) { - hcl_setsynerr (moo, MOO_SYNERR_POOLDICINVAL, TOKEN_LOC(moo), name); + moo_setsynerr (moo, MOO_SYNERR_POOLDICINVAL, TOKEN_LOC(moo), name); return -1; } @@ -3171,7 +3171,7 @@ static int resolve_pooldic (moo_t* moo, int dotted, const moo_oocs_t* name) { if ((moo_oop_dic_t)ass->value == moo->c->cls.pooldic_imp.oops[i]) { - hcl_setsynerr (moo, MOO_SYNERR_POOLDICDUPL, TOKEN_LOC(moo), name); + moo_setsynerr (moo, MOO_SYNERR_POOLDICDUPL, TOKEN_LOC(moo), name); return -1; } } @@ -3189,7 +3189,7 @@ static int import_pool_dictionary (moo_t* moo, moo_oop_nsdic_t ns_oop, const moo ass = moo_lookupdic (moo, (moo_oop_dic_t)ns_oop, tok_lastseg); if (!ass || MOO_CLASSOF(moo, ass->value) != moo->_pool_dictionary) { - hcl_setsynerr (moo, MOO_SYNERR_POOLDICINVAL, tok_loc, tok_name); + moo_setsynerr (moo, MOO_SYNERR_POOLDICINVAL, tok_loc, tok_name); return -1; } @@ -3198,7 +3198,7 @@ static int import_pool_dictionary (moo_t* moo, moo_oop_nsdic_t ns_oop, const moo { if ((moo_oop_dic_t)ass->value == moo->c->cls.pooldic_imp.oops[i]) { - hcl_setsynerr (moo, MOO_SYNERR_POOLDICDUPL, tok_loc, tok_name); + moo_setsynerr (moo, MOO_SYNERR_POOLDICDUPL, tok_loc, tok_name); return -1; } } @@ -3235,7 +3235,7 @@ if super is variable-nonpointer, no instance variable is allowed. if (dcl_type == VAR_INSTANCE && (moo->c->cls.flags & CLASS_INDEXED) && (moo->c->cls.indexed_type != MOO_OBJ_TYPE_OOP)) { /* a non-pointer object cannot have instance variables */ - hcl_setsynerr (moo, MOO_SYNERR_VARDCLBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARDCLBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3243,7 +3243,7 @@ if super is variable-nonpointer, no instance variable is allowed. moo_lookupdic(moo, (moo_oop_dic_t)moo->sysdic, TOKEN_NAME(moo)) || /* conflicts with a top global name */ moo_lookupdic(moo, (moo_oop_dic_t)moo->c->cls.ns_oop, TOKEN_NAME(moo))) /* conflicts with a global name in the class'es name space */ { - hcl_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3260,7 +3260,7 @@ if super is variable-nonpointer, no instance variable is allowed. if (!is_token_binary_selector(moo, VOCA_VBAR)) { - hcl_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3287,7 +3287,7 @@ static int compile_class_level_variables (moo_t* moo) /* variable(#class) */ if (dcl_type != VAR_INSTANCE) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3299,7 +3299,7 @@ static int compile_class_level_variables (moo_t* moo) /* variable(#classinst) */ if (dcl_type != VAR_INSTANCE) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3311,7 +3311,7 @@ static int compile_class_level_variables (moo_t* moo) /* variable(#get) */ if (varacc_type & VARACC_GETTER) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3323,7 +3323,7 @@ static int compile_class_level_variables (moo_t* moo) /* variable(#set) */ if (varacc_type & VARACC_SETTER) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3333,13 +3333,13 @@ static int compile_class_level_variables (moo_t* moo) else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_RPAREN) { /* no modifier is present */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else { /* invalid modifier */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3352,7 +3352,7 @@ static int compile_class_level_variables (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { /* ) expected */ - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3378,7 +3378,7 @@ if super is variable-nonpointer, no instance variable is allowed. if (dcl_type == VAR_INSTANCE && (moo->c->cls.flags & CLASS_INDEXED) && (moo->c->cls.indexed_type != MOO_OBJ_TYPE_OOP)) { /* a non-pointer object cannot have instance variables */ - hcl_setsynerr (moo, MOO_SYNERR_VARDCLBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARDCLBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3386,7 +3386,7 @@ if super is variable-nonpointer, no instance variable is allowed. moo_lookupdic(moo, (moo_oop_dic_t)moo->sysdic, TOKEN_NAME(moo)) || /* conflicts with a top global name */ moo_lookupdic(moo, (moo_oop_dic_t)moo->c->cls.ns_oop, TOKEN_NAME(moo))) /* conflicts with a global name in the class'es name space */ { - hcl_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3424,7 +3424,7 @@ if super is variable-nonpointer, no instance variable is allowed. else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_PERIOD) { /* no variable name is present */ - hcl_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else @@ -3434,7 +3434,7 @@ if super is variable-nonpointer, no instance variable is allowed. if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT) { - hcl_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) break; /* hopefully . */ @@ -3444,7 +3444,7 @@ if super is variable-nonpointer, no instance variable is allowed. if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD) { - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3479,7 +3479,7 @@ static int compile_class_level_imports (moo_t* moo) /* import(#pooldic) - import a pool dictionary */ if (dcl_type != IMPORT_POOLDIC) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3491,13 +3491,13 @@ static int compile_class_level_imports (moo_t* moo) if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_RPAREN) { /* no modifier is present */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else { /* invalid modifier */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3510,7 +3510,7 @@ static int compile_class_level_imports (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { /* ) expected */ - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3532,7 +3532,7 @@ static int compile_class_level_imports (moo_t* moo) else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_PERIOD) { /* no variable name is present */ - hcl_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else @@ -3545,7 +3545,7 @@ static int compile_class_level_imports (moo_t* moo) if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT_DOTTED || TOKEN_TYPE(moo) == MOO_IOTOK_IDENT) { - hcl_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) break; /* hopefully . */ @@ -3555,7 +3555,7 @@ static int compile_class_level_imports (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD) { - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3585,13 +3585,13 @@ static int compile_unary_method_name (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT) { /* wrong argument name. identifier is expected */ - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) { - hcl_setsynerr (moo, MOO_SYNERR_ARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_ARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3603,7 +3603,7 @@ static int compile_unary_method_name (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) { - hcl_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3631,7 +3631,7 @@ static int compile_binary_method_name (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT) { /* wrong argument name. identifier expected */ - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3646,7 +3646,7 @@ static int compile_binary_method_name (moo_t* moo) /* this check should not be not necessary if (moo->c->mth.tmpr_nargs > MAX_CODE_NARGS) { - hcl_setsynerr (moo, MOO_SYNERR_ARGFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_ARGFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } */ @@ -3668,13 +3668,13 @@ static int compile_keyword_method_name (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT) { /* wrong argument name. identifier is expected */ - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) { - hcl_setsynerr (moo, MOO_SYNERR_ARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_ARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3719,7 +3719,7 @@ static int compile_method_name (moo_t* moo) default: /* illegal method name */ - hcl_setsynerr (moo, MOO_SYNERR_MTHNAME, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MTHNAME, TOKEN_LOC(moo), TOKEN_NAME(moo)); n = -1; } @@ -3727,14 +3727,14 @@ static int compile_method_name (moo_t* moo) { if (method_exists(moo, &moo->c->mth.name)) { - hcl_setsynerr (moo, MOO_SYNERR_MTHNAMEDUPL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_MTHNAMEDUPL, &moo->c->mth.name_loc, &moo->c->mth.name); return -1; } /* compile_unary_method_name() returns 9999 if the name is followed by () */ if (moo->c->mth.variadic && n != 9999) { - hcl_setsynerr (moo, MOO_SYNERR_VARIADMTHINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_VARIADMTHINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); return -1; } } @@ -3770,7 +3770,7 @@ static int compile_method_temporaries (moo_t* moo) * variable */ if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) { - hcl_setsynerr (moo, MOO_SYNERR_TMPRNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_TMPRNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3779,7 +3779,7 @@ static int compile_method_temporaries (moo_t* moo) if (moo->c->mth.tmpr_count > MAX_CODE_NARGS) { - hcl_setsynerr (moo, MOO_SYNERR_TMPRFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_TMPRFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3788,7 +3788,7 @@ static int compile_method_temporaries (moo_t* moo) if (!is_token_binary_selector(moo, VOCA_VBAR)) { - hcl_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3829,7 +3829,7 @@ static int compile_method_pragma (moo_t* moo) pfnum = pfnum * 10 + (*ptr - '0'); if (!MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(pfnum)) { - hcl_setsynerr (moo, MOO_SYNERR_PFNUMINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PFNUMINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3861,7 +3861,7 @@ static int compile_method_pragma (moo_t* moo) if (!moo_rfindoochar (tptr, tlen, '.')) { /* wrong primitive function identifier */ - hcl_setsynerr (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3872,7 +3872,7 @@ static int compile_method_pragma (moo_t* moo) if (!pfbase) { MOO_DEBUG2 (moo, "Cannot find module primitive function - %.*js\n", tlen, tptr); - hcl_setsynerr (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3880,7 +3880,7 @@ static int compile_method_pragma (moo_t* moo) { MOO_DEBUG5 (moo, "Unsupported argument count in primitive method definition of %.*js - %zd-%zd expected, %zd specified\n", tlen, tptr, pfbase->minargs, pfbase->maxargs, moo->c->mth.tmpr_nargs); - hcl_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); return -1; } @@ -3895,7 +3895,7 @@ static int compile_method_pragma (moo_t* moo) } else if (!MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(pfnum)) { - hcl_setsynerr (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else @@ -3904,7 +3904,7 @@ static int compile_method_pragma (moo_t* moo) { MOO_DEBUG5 (moo, "Unsupported argument count in primitive method definition of %.*js - %zd-%zd expected, %zd specified\n", tlen, tptr, pfbase->minargs, pfbase->maxargs, moo->c->mth.tmpr_nargs); - hcl_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); return -1; } @@ -3916,7 +3916,7 @@ static int compile_method_pragma (moo_t* moo) } default: - hcl_setsynerr (moo, MOO_SYNERR_INTEGER, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_INTEGER, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3933,14 +3933,14 @@ static int compile_method_pragma (moo_t* moo) } else { - hcl_setsynerr (moo, MOO_SYNERR_PRIMITIVE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PRIMITIVE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } GET_TOKEN (moo); if (!is_token_binary_selector(moo, VOCA_GT)) { - hcl_setsynerr (moo, MOO_SYNERR_GT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_GT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -3956,7 +3956,7 @@ static int validate_class_level_variable (moo_t* moo, var_info_t* var, const moo if (moo->c->mth.type == MOO_METHOD_CLASS || moo->c->mth.type == MOO_METHOD_DUAL) { /* a class(or dual) method cannot access an instance variable */ - hcl_setsynerr (moo, MOO_SYNERR_VARINACC, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARINACC, name_loc, name); return -1; } break; @@ -3966,7 +3966,7 @@ static int validate_class_level_variable (moo_t* moo, var_info_t* var, const moo if (moo->c->mth.type == MOO_METHOD_INSTANCE || moo->c->mth.type == MOO_METHOD_DUAL) { /* an instance method cannot access a class-instance variable */ - hcl_setsynerr (moo, MOO_SYNERR_VARINACC, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARINACC, name_loc, name); return -1; } @@ -4041,7 +4041,7 @@ static MOO_INLINE int find_dotted_ident (moo_t* moo, const moo_oocs_t* name, con { /* self. is followed by a reserved word. * a proper variable name is expected. */ - hcl_setsynerr (moo, MOO_SYNERR_VARNAME, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARNAME, name_loc, name); return -1; } @@ -4082,7 +4082,7 @@ static MOO_INLINE int find_dotted_ident (moo_t* moo, const moo_oocs_t* name, con v = find_element_in_compiling_pooldic (moo, &last); if (!v) { - hcl_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); return -1; } @@ -4099,7 +4099,7 @@ static MOO_INLINE int find_dotted_ident (moo_t* moo, const moo_oocs_t* name, con * the pooldic is a terminal point and the items inside * are final nodes. if self is followed by more than 1 * subsegments, it's */ - hcl_setsynerr (moo, MOO_SYNERR_VARINACC, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARINACC, name_loc, name); return -1; } @@ -4137,7 +4137,7 @@ static MOO_INLINE int find_dotted_ident (moo_t* moo, const moo_oocs_t* name, con if (!ass) { /* undeclared identifier */ - hcl_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); return -1; } @@ -4192,7 +4192,7 @@ static MOO_INLINE int find_undotted_ident (moo_t* moo, const moo_oocs_t* name, c v = find_element_in_compiling_pooldic (moo, name); if (!v) { - hcl_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); return -1; } @@ -4227,7 +4227,7 @@ static MOO_INLINE int find_undotted_ident (moo_t* moo, const moo_oocs_t* name, c if (ass2) { /* the variable name has been found at least in 2 dictionaries - ambiguous */ - hcl_setsynerr (moo, MOO_SYNERR_VARAMBIG, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARAMBIG, name_loc, name); return -1; } ass2 = ass; @@ -4237,7 +4237,7 @@ static MOO_INLINE int find_undotted_ident (moo_t* moo, const moo_oocs_t* name, c ass = ass2; if (!ass) { - hcl_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARUNDCL, name_loc, name); return -1; } } @@ -4263,7 +4263,7 @@ static int get_variable_info (moo_t* moo, const moo_oocs_t* name, const moo_iolo { /* the assignee is not usable because its index is too large * to be expressed in byte-codes. */ - hcl_setsynerr (moo, MOO_SYNERR_VARUNUSE, name_loc, name); + moo_setsynerr (moo, MOO_SYNERR_VARUNUSE, name_loc, name); return -1; } @@ -4289,7 +4289,7 @@ static int compile_block_temporaries (moo_t* moo) { if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) { - hcl_setsynerr (moo, MOO_SYNERR_TMPRNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_TMPRNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -4297,7 +4297,7 @@ static int compile_block_temporaries (moo_t* moo) moo->c->mth.tmpr_count++; if (moo->c->mth.tmpr_count > MAX_CODE_NTMPRS) { - hcl_setsynerr (moo, MOO_SYNERR_TMPRFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_TMPRFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -4306,7 +4306,7 @@ static int compile_block_temporaries (moo_t* moo) if (!is_token_binary_selector(moo, VOCA_VBAR)) { - hcl_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -4377,14 +4377,14 @@ static int compile_block_expression (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT) { /* wrong argument name. identifier expected */ - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } /* TODO: check conflicting names as well */ if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) { - hcl_setsynerr (moo, MOO_SYNERR_BLKARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_BLKARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -4392,7 +4392,7 @@ static int compile_block_expression (moo_t* moo) moo->c->mth.tmpr_count++; if (moo->c->mth.tmpr_count > MAX_CODE_NARGS) { - hcl_setsynerr (moo, MOO_SYNERR_BLKARGFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_BLKARGFLOOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -4402,7 +4402,7 @@ static int compile_block_expression (moo_t* moo) if (!is_token_binary_selector(moo, VOCA_VBAR)) { - hcl_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VBAR, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -4416,7 +4416,7 @@ static int compile_block_expression (moo_t* moo) * block arguments, evaluation which is done by message passing * limits the number of arguments that can be passed. so the * check is implemented */ - hcl_setsynerr (moo, MOO_SYNERR_BLKARGFLOOD, &colon_loc, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_BLKARGFLOOD, &colon_loc, MOO_NULL); return -1; } @@ -4427,7 +4427,7 @@ static int compile_block_expression (moo_t* moo) block_tmpr_count = moo->c->mth.tmpr_count - saved_tmpr_count; if (block_tmpr_count > MAX_CODE_NBLKTMPRS) { - hcl_setsynerr (moo, MOO_SYNERR_BLKTMPRFLOOD, &tmpr_loc, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_BLKTMPRFLOOD, &tmpr_loc, MOO_NULL); return -1; } @@ -4472,7 +4472,7 @@ static int compile_block_expression (moo_t* moo) } else { - hcl_setsynerr (moo, MOO_SYNERR_RBRACK, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACK, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } @@ -4565,13 +4565,13 @@ static int read_byte_array_literal (moo_t* moo, moo_oop_t* xlit) /* if the token is out of the SMOOI range, it's too big or * to small to be a byte */ - hcl_setsynerr (moo, MOO_SYNERR_BYTERANGE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_BYTERANGE, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } if (tmp < 0 || tmp > 255) { - hcl_setsynerr (moo, MOO_SYNERR_BYTERANGE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_BYTERANGE, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -4605,13 +4605,13 @@ static int read_byte_array_literal (moo_t* moo, moo_oop_t* xlit) if (TOKEN_TYPE(moo) == MOO_IOTOK_RBRACK) break; if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) { - hcl_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } GET_TOKEN_GOTO (moo, oops); if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_RBRACK) { - hcl_setsynerr (moo, MOO_SYNERR_LITERAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LITERAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } } @@ -4619,7 +4619,7 @@ static int read_byte_array_literal (moo_t* moo, moo_oop_t* xlit) if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACK) { - hcl_setsynerr (moo, MOO_SYNERR_RBRACK, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACK, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -4650,7 +4650,7 @@ static int read_array_literal (moo_t* moo, int rdonly, moo_oop_t* xlit) { if (TOKEN_TYPE(moo) == MOO_IOTOK_EOF) { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } else if (TOKEN_TYPE(moo) == MOO_IOTOK_RPAREN) break; @@ -4737,7 +4737,7 @@ static int compile_array_expression (moo_t* moo) if (index > MAX_CODE_PARAM) { - hcl_setsynerr (moo, MOO_SYNERR_ARREXPFLOOD, &aeloc, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_ARREXPFLOOD, &aeloc, MOO_NULL); return -1; } @@ -4745,7 +4745,7 @@ static int compile_array_expression (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) { - hcl_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5055,14 +5055,14 @@ static int compile_expression_primary (moo_t* moo, const moo_oocs_t* ident, cons if (compile_method_expression(moo, 0) <= -1) return -1; if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } GET_TOKEN (moo); break; default: - hcl_setsynerr (moo, MOO_SYNERR_PRIMARYINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PRIMARYINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } @@ -5104,7 +5104,7 @@ static int compile_unary_message (moo_t* moo, int to_super) if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) { - hcl_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5213,7 +5213,7 @@ static int compile_keyword_message (moo_t* moo, int to_super) * if it parses an expression like 'aBlock value: 10 with: 20', * 'kw' may point to 'value:' or 'with:'. */ - hcl_setsynerr (moo, MOO_SYNERR_ARGFLOOD, &saved_kwsel_loc, &kw); + moo_setsynerr (moo, MOO_SYNERR_ARGFLOOD, &saved_kwsel_loc, &kw); goto oops; } @@ -5383,7 +5383,7 @@ static int compile_braced_block (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_LBRACE) { - hcl_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5405,7 +5405,7 @@ static int compile_braced_block (moo_t* moo) } else { - hcl_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } @@ -5419,7 +5419,7 @@ static int compile_braced_block (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACE) { - hcl_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5430,7 +5430,7 @@ static int compile_conditional (moo_t* moo) { if (TOKEN_TYPE(moo) != MOO_IOTOK_LPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5442,7 +5442,7 @@ static int compile_conditional (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5664,7 +5664,7 @@ static int compile_while_expression (moo_t* moo) /* or compile_until_expression { /* the jump offset is out of the representable range by the offset * portion of the jump instruction */ - hcl_setsynerr (moo, MOO_SYNERR_BLKFLOOD, &while_loc, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_BLKFLOOD, &while_loc, MOO_NULL); } goto oops; } @@ -5724,7 +5724,7 @@ static int compile_do_while_expression (moo_t* moo) else if (TOKEN_TYPE(moo) == MOO_IOTOK_WHILE) is_until_loop = 0; else { - hcl_setsynerr (moo, MOO_SYNERR_WHILE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_WHILE, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } GET_TOKEN (moo); /* get ( */ @@ -5783,7 +5783,7 @@ static int compile_do_while_expression (moo_t* moo) { /* the jump offset is out of the representable range by the offset * portion of the jump instruction */ - hcl_setsynerr (moo, MOO_SYNERR_BLKFLOOD, &do_loc, MOO_NULL); + moo_setsynerr (moo, MOO_SYNERR_BLKFLOOD, &do_loc, MOO_NULL); } goto oops; } @@ -5975,13 +5975,13 @@ static int compile_special_statement (moo_t* moo) if (!moo->c->mth.loop) { /* break outside a loop */ - hcl_setsynerr (moo, MOO_SYNERR_NOTINLOOP, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_NOTINLOOP, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } if (moo->c->mth.loop->blkcount > 0) { /* break cannot cross boundary of a block */ - hcl_setsynerr (moo, MOO_SYNERR_INBLOCK, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_INBLOCK, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -5992,13 +5992,13 @@ static int compile_special_statement (moo_t* moo) { if (!moo->c->mth.loop) { - hcl_setsynerr (moo, MOO_SYNERR_NOTINLOOP, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_NOTINLOOP, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } if (moo->c->mth.loop->blkcount > 0) { /* continue cannot cross boundary of a block */ - hcl_setsynerr (moo, MOO_SYNERR_INBLOCK, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_INBLOCK, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6115,7 +6115,7 @@ static int compile_method_statements (moo_t* moo) TOKEN_TYPE(moo) == MOO_IOTOK_RBRACE) break; /* not a period, EOF, nor } */ - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } @@ -6378,7 +6378,7 @@ static int __compile_method_definition (moo_t* moo) /* method(#class) */ if (moo->c->mth.type == MOO_METHOD_CLASS || moo->c->mth.type == MOO_METHOD_DUAL) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6390,7 +6390,7 @@ static int __compile_method_definition (moo_t* moo) /* method(#dual) */ if (moo->c->mth.type == MOO_METHOD_CLASS || moo->c->mth.type == MOO_METHOD_DUAL) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6403,7 +6403,7 @@ static int __compile_method_definition (moo_t* moo) if (moo->c->mth.primitive) { /* #primitive duplicate modifier */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6415,7 +6415,7 @@ static int __compile_method_definition (moo_t* moo) /* method(#lenient) */ if (moo->c->mth.lenient) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } moo->c->mth.lenient = 1; @@ -6428,7 +6428,7 @@ static int __compile_method_definition (moo_t* moo) if (moo->c->mth.variadic) { /* #variadic duplicate modifier */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6442,13 +6442,13 @@ static int __compile_method_definition (moo_t* moo) else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_RPAREN) { /* no modifier is present */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else { /* invalid modifier */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6461,7 +6461,7 @@ static int __compile_method_definition (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { /* ) expected */ - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6480,7 +6480,7 @@ static int __compile_method_definition (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD) { /* . expected */ - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6500,7 +6500,7 @@ static int __compile_method_definition (moo_t* moo) if (mthname.len == 0) { MOO_DEBUG2 (moo, "Invalid primitive function name - %.*js\n", moo->c->mth.name.len, moo->c->mth.name.ptr); - hcl_setsynerr (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); return -1; } @@ -6531,7 +6531,7 @@ static int __compile_method_definition (moo_t* moo) { MOO_DEBUG2 (moo, "Cannot find intrinsic primitive function - %.*js\n", moo->c->cls.modname.len - savedlen, &moo->c->cls.modname.ptr[savedlen]); - hcl_setsynerr (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); moo->c->cls.modname.len = savedlen; return -1; } @@ -6541,7 +6541,7 @@ static int __compile_method_definition (moo_t* moo) MOO_DEBUG5 (moo, "Unsupported argument count in primitive method definition of %.*js - %zd-%zd expected, %zd specified\n", moo->c->cls.modname.len - savedlen, &moo->c->cls.modname.ptr[savedlen], pfbase->minargs, pfbase->maxargs, moo->c->mth.tmpr_nargs); - hcl_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); moo->c->cls.modname.len = savedlen; return -1; } @@ -6582,7 +6582,7 @@ static int __compile_method_definition (moo_t* moo) { MOO_DEBUG2 (moo, "Cannot find module primitive function - %.*js\n", moo->c->cls.modname.len - savedlen, &moo->c->cls.modname.ptr[savedlen]); - hcl_setsynerr (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFIDINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); moo->c->cls.modname.len = savedlen; return -1; } @@ -6592,7 +6592,7 @@ static int __compile_method_definition (moo_t* moo) MOO_DEBUG5 (moo, "Unsupported argument count in primitive method definition of %.*js - %zd-%zd expected, %zd specified\n", moo->c->cls.modname.len - savedlen, &moo->c->cls.modname.ptr[savedlen], pfbase->minargs, pfbase->maxargs, moo->c->mth.tmpr_nargs); - hcl_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); + moo_setsynerr (moo, MOO_SYNERR_PFARGDEFINVAL, &moo->c->mth.name_loc, &moo->c->mth.name); moo->c->cls.modname.len = savedlen; return -1; } @@ -6612,7 +6612,7 @@ static int __compile_method_definition (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_LBRACE) { /* { expected */ - hcl_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -6625,7 +6625,7 @@ static int __compile_method_definition (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACE) { /* } expected */ - hcl_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } @@ -6950,7 +6950,7 @@ static int make_defined_class (moo_t* moo) self_spec != MOO_OOP_TO_SMOOI(moo->c->cls.self_oop->selfspec)) { /* it conflicts with internal definition */ - hcl_setsynerr (moo, MOO_SYNERR_CLASSCONTRA, &moo->c->cls.fqn_loc, &moo->c->cls.name); + moo_setsynerr (moo, MOO_SYNERR_CLASSCONTRA, &moo->c->cls.fqn_loc, &moo->c->cls.name); return -1; } } @@ -7091,7 +7091,7 @@ static MOO_INLINE int _set_class_indexed_type (moo_t* moo, moo_obj_type_t type) { if (moo->c->cls.flags & CLASS_INDEXED) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7184,7 +7184,7 @@ static int __compile_class_definition (moo_t* moo, int extend) { if (moo->c->cls.flags & CLASS_FINAL) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } moo->c->cls.flags |= CLASS_FINAL; @@ -7194,7 +7194,7 @@ static int __compile_class_definition (moo_t* moo, int extend) { if (moo->c->cls.flags & CLASS_LIMITED) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } moo->c->cls.flags |= CLASS_LIMITED; @@ -7204,7 +7204,7 @@ static int __compile_class_definition (moo_t* moo, int extend) { if (moo->c->cls.flags & CLASS_IMMUTABLE) { - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } moo->c->cls.flags |= CLASS_IMMUTABLE; @@ -7213,13 +7213,13 @@ static int __compile_class_definition (moo_t* moo, int extend) else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_RPAREN) { /* no modifier is present */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } else { /* invalid modifier */ - hcl_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7238,7 +7238,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) != MOO_IOTOK_NUMLIT && TOKEN_TYPE(moo) != MOO_IOTOK_RADNUMLIT) { - hcl_setsynerr (moo, MOO_SYNERR_LITERAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LITERAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7248,7 +7248,7 @@ static int __compile_class_definition (moo_t* moo, int extend) /* the class type size has nothing to do with the name instance variables * in the semantics. but it is stored into the named-instvar bits in the * spec field of a class. so i check it against MOO_MAX_NAMED_INSTVARS. */ - hcl_setsynerr (moo, MOO_SYNERR_NPINSTSIZEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_NPINSTSIZEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7256,7 +7256,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } GET_TOKEN (moo); @@ -7274,7 +7274,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7285,7 +7285,7 @@ static int __compile_class_definition (moo_t* moo, int extend) TOKEN_TYPE(moo) != MOO_IOTOK_IDENT_DOTTED) { /* class name expected. */ - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7293,7 +7293,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT && is_restricted_word (TOKEN_NAME(moo))) { /* wrong class name */ - hcl_setsynerr (moo, MOO_SYNERR_CLASSNAMEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_CLASSNAMEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } #endif @@ -7334,7 +7334,7 @@ static int __compile_class_definition (moo_t* moo, int extend) else { /* only an existing class can be extended. */ - hcl_setsynerr (moo, MOO_SYNERR_CLASSUNDEF, &moo->c->cls.fqn_loc, &moo->c->cls.name); + moo_setsynerr (moo, MOO_SYNERR_CLASSUNDEF, &moo->c->cls.fqn_loc, &moo->c->cls.name); return -1; } @@ -7352,7 +7352,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) != MOO_IOTOK_LPAREN) { - hcl_setsynerrbfmt (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo), "superclass must be specified"); + moo_setsynerrbfmt (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo), "superclass must be specified"); return -1; } @@ -7369,7 +7369,7 @@ static int __compile_class_definition (moo_t* moo, int extend) else if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT && TOKEN_TYPE(moo) != MOO_IOTOK_IDENT_DOTTED) { /* superclass name expected */ - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7381,7 +7381,7 @@ static int __compile_class_definition (moo_t* moo, int extend) GET_TOKEN (moo); if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7396,7 +7396,7 @@ static int __compile_class_definition (moo_t* moo, int extend) /* the object found with the name is not a class object * or the the class object found is a fully defined kernel * class object */ - hcl_setsynerr (moo, MOO_SYNERR_CLASSDUPL, &moo->c->cls.fqn_loc, &moo->c->cls.name); + moo_setsynerr (moo, MOO_SYNERR_CLASSDUPL, &moo->c->cls.fqn_loc, &moo->c->cls.name); return -1; } @@ -7436,7 +7436,7 @@ static int __compile_class_definition (moo_t* moo, int extend) moo->c->cls.indexed_type != MOO_OBJ_TYPE_OOP) { /* non-pointer object cannot inherit from a superclass with trailer size set */ - hcl_setsynerrbfmt (moo, MOO_SYNERR_INHERITBANNED, &moo->c->cls.fqn_loc, &moo->c->cls.fqn, + moo_setsynerrbfmt (moo, MOO_SYNERR_INHERITBANNED, &moo->c->cls.fqn_loc, &moo->c->cls.fqn, "the non-pointer class %.*js cannot inherit from a class set with trailer size", moo->c->cls.fqn.len, moo->c->cls.fqn.ptr); return -1; @@ -7445,7 +7445,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (MOO_CLASS_SELFSPEC_FLAGS(MOO_OOP_TO_SMOOI(((moo_oop_class_t)moo->c->cls.super_oop)->selfspec)) & MOO_CLASS_SELFSPEC_FLAG_FINAL) { /* cannot inherit a #final class */ - hcl_setsynerrbfmt (moo, MOO_SYNERR_INHERITBANNED, &moo->c->cls.fqn_loc, &moo->c->cls.fqn, + moo_setsynerrbfmt (moo, MOO_SYNERR_INHERITBANNED, &moo->c->cls.fqn_loc, &moo->c->cls.fqn, "the %.*js class cannot inherit from a final class", moo->c->cls.fqn.len, moo->c->cls.fqn.ptr); return -1; } @@ -7457,7 +7457,7 @@ static int __compile_class_definition (moo_t* moo, int extend) * the object found with the name is not a class object. or, * the class object found is a internally defined kernel * class object. */ - hcl_setsynerr (moo, MOO_SYNERR_CLASSUNDEF, &moo->c->cls.superfqn_loc, &moo->c->cls.superfqn); + moo_setsynerr (moo, MOO_SYNERR_CLASSUNDEF, &moo->c->cls.superfqn_loc, &moo->c->cls.superfqn); return -1; } } @@ -7469,7 +7469,7 @@ static int __compile_class_definition (moo_t* moo, int extend) GET_TOKEN (moo); if (TOKEN_TYPE(moo) != MOO_IOTOK_STRLIT) { - hcl_setsynerr (moo, MOO_SYNERR_STRING, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_STRING, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7482,7 +7482,7 @@ static int __compile_class_definition (moo_t* moo, int extend) * a period to a dash when mapping the module name to an * actual module file. disallowing a dash lowers confusion * when loading a module. */ - hcl_setsynerr (moo, MOO_SYNERR_MODNAMEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_MODNAMEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7495,7 +7495,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) != MOO_IOTOK_LBRACE) { - hcl_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7520,7 +7520,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (MOO_CLASS_SPEC_INDEXED_TYPE(spec) == MOO_OBJ_TYPE_OOP && MOO_CLASS_SPEC_NAMED_INSTVARS(spec) > 0) { /* a non-pointer object cannot inherit from a pointer object with instance variables */ - hcl_setsynerrbfmt (moo, MOO_SYNERR_INHERITBANNED, &moo->c->cls.fqn_loc, &moo->c->cls.fqn, + moo_setsynerrbfmt (moo, MOO_SYNERR_INHERITBANNED, &moo->c->cls.fqn_loc, &moo->c->cls.fqn, "the non-pointer class %.*js cannot inherit from a pointer class defined with instance variables", moo->c->cls.fqn.len, moo->c->cls.fqn.ptr); return -1; @@ -7532,7 +7532,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (moo->c->cls.non_pointer_instsize < MOO_CLASS_SPEC_NAMED_INSTVARS(spec)) { - hcl_setsynerrbfmt (moo, MOO_SYNERR_NPINSTSIZEINVAL, &type_loc, MOO_NULL, + moo_setsynerrbfmt (moo, MOO_SYNERR_NPINSTSIZEINVAL, &type_loc, MOO_NULL, "the instance size(%zu) for the non-pointer class %.*js must not be less than the size(%zu) defined in the superclass ", moo->c->cls.non_pointer_instsize, moo->c->cls.fqn.len, moo->c->cls.fqn.ptr, (moo_oow_t)MOO_CLASS_SPEC_NAMED_INSTVARS(spec)); return -1; @@ -7556,7 +7556,7 @@ static int __compile_class_definition (moo_t* moo, int extend) /* when a class is extended, a new variable cannot be added */ if (is_token_word(moo, VOCA_VAR) || is_token_word(moo, VOCA_VARIABLE)) { - hcl_setsynerr (moo, MOO_SYNERR_VARDCLBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARDCLBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7664,7 +7664,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (moo_importmod (moo, moo->c->cls.self_oop, moo->c->cls.modname.ptr, moo->c->cls.modname.len) <= -1) { const moo_ooch_t* oldmsg = moo_backuperrmsg(moo); - hcl_setsynerrbfmt (moo, MOO_SYNERR_MODIMPFAIL, &moo->c->cls.modname_loc, &moo->c->cls.modname, + moo_setsynerrbfmt (moo, MOO_SYNERR_MODIMPFAIL, &moo->c->cls.modname_loc, &moo->c->cls.modname, "unable to import %.*js - %js", moo->c->cls.modname.len, moo->c->cls.modname.ptr, oldmsg); return -1; } @@ -7696,7 +7696,7 @@ static int __compile_class_definition (moo_t* moo, int extend) if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACE) { - hcl_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -7833,7 +7833,7 @@ static moo_oop_t token_to_literal (moo_t* moo, int rdonly) } else { - hcl_setsynerr (moo, MOO_SYNERR_VARINACC, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_VARINACC, TOKEN_LOC(moo), TOKEN_NAME(moo)); return MOO_NULL; } @@ -7865,7 +7865,7 @@ static moo_oop_t token_to_literal (moo_t* moo, int rdonly) } default: - hcl_setsynerr (moo, MOO_SYNERR_LITERAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LITERAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return MOO_NULL; } } @@ -7902,7 +7902,7 @@ static int __compile_pooldic_definition (moo_t* moo, moo_pooldic_t* pd) if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT && TOKEN_TYPE(moo) != MOO_IOTOK_IDENT_DOTTED) { - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -7925,14 +7925,14 @@ static int __compile_pooldic_definition (moo_t* moo, moo_pooldic_t* pd) if (moo_lookupdic (moo, (moo_oop_dic_t)pd->ns_oop, &pd->name)) { /* a conflicting entry has been found */ - hcl_setsynerr (moo, MOO_SYNERR_POOLDICDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_POOLDICDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } GET_TOKEN (moo); if (TOKEN_TYPE(moo) != MOO_IOTOK_LBRACE) { - hcl_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -7951,7 +7951,7 @@ static int __compile_pooldic_definition (moo_t* moo, moo_pooldic_t* pd) if (TOKEN_TYPE(moo) != MOO_IOTOK_ASSIGN) { - hcl_setsynerr (moo, MOO_SYNERR_ASSIGN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_ASSIGN, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -7973,7 +7973,7 @@ static int __compile_pooldic_definition (moo_t* moo, moo_pooldic_t* pd) /*if (TOKEN_TYPE(moo) == MOO_IOTOK_RBRACE) goto done; else*/ if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD) { - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -7983,7 +7983,7 @@ static int __compile_pooldic_definition (moo_t* moo, moo_pooldic_t* pd) if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACE) { - hcl_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RBRACE, TOKEN_LOC(moo), TOKEN_NAME(moo)); goto oops; } @@ -8050,7 +8050,7 @@ static int compile_pragma_definition (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT) { - hcl_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -8075,7 +8075,7 @@ static int compile_pragma_definition (moo_t* moo) GET_TOKEN(moo); if (TOKEN_TYPE(moo) != MOO_IOTOK_LPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_LPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -8092,20 +8092,20 @@ static int compile_pragma_definition (moo_t* moo) } else { - hcl_setsynerr (moo, MOO_SYNERR_DIRECTIVEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_DIRECTIVEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } GET_TOKEN(moo); if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) { - hcl_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_RPAREN, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } else { - hcl_setsynerr (moo, MOO_SYNERR_PRAGMAINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PRAGMAINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -8116,7 +8116,7 @@ static int compile_pragma_definition (moo_t* moo) if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD) { - hcl_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } @@ -8137,7 +8137,7 @@ static int compile_stream (moo_t* moo) GET_TOKEN (moo); if (TOKEN_TYPE(moo) != MOO_IOTOK_STRLIT) { - hcl_setsynerr (moo, MOO_SYNERR_STRING, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr (moo, MOO_SYNERR_STRING, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } if (begin_include(moo) <= -1) return -1; @@ -8183,7 +8183,7 @@ static int compile_stream (moo_t* moo) #endif else { - hcl_setsynerr(moo, MOO_SYNERR_DIRECTIVEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + moo_setsynerr(moo, MOO_SYNERR_DIRECTIVEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); return -1; } } diff --git a/moo/lib/err.c b/moo/lib/err.c index 23f664e..4204cdb 100644 --- a/moo/lib/err.c +++ b/moo/lib/err.c @@ -349,18 +349,27 @@ void moo_seterrwithsyserr (moo_t* moo, int syserr) #if defined(MOO_INCLUDE_COMPILER) -void hcl_setsynerrbfmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, const moo_oocs_t* tgt, const moo_bch_t* msgfmt, ...) +void moo_setsynerrbfmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, const moo_oocs_t* tgt, const moo_bch_t* msgfmt, ...) { + static moo_bch_t syntax_error[] = "syntax error - "; + if (msgfmt) { va_list ap; + int i, selen; + va_start (ap, msgfmt); moo_seterrbfmtv (moo, MOO_ESYNERR, msgfmt, ap); va_end (ap); + + selen = MOO_COUNTOF(syntax_error) - 1; + MOO_MEMMOVE (&moo->errmsg.buf[selen], &moo->errmsg.buf[0], MOO_SIZEOF(moo->errmsg.buf[0]) * (MOO_COUNTOF(moo->errmsg.buf) - selen)); + for (i = 0; i < selen; i++) moo->errmsg.buf[i] = syntax_error[i]; + moo->errmsg.buf[MOO_COUNTOF(moo->errmsg.buf) - 1] = '\0'; } else { - moo_seterrbfmt (moo, MOO_ESYNERR, "syntax error - %js", synerr_to_errstr(num)); + moo_seterrbfmt (moo, MOO_ESYNERR, "%hs%js", syntax_error, synerr_to_errstr(num)); } moo->c->synerr.num = num; @@ -370,11 +379,18 @@ void hcl_setsynerrbfmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, * moo->c->tok.loc due to 'const' prefixed to loc. */ /*moo->c->synerr.loc = loc? *loc: moo->c->tok.loc;*/ if (loc) + { moo->c->synerr.loc = *loc; + } else + { moo->c->synerr.loc = moo->c->tok.loc; + } - if (tgt) moo->c->synerr.tgt = *tgt; + if (tgt) + { + moo->c->synerr.tgt = *tgt; + } else { moo->c->synerr.tgt.ptr = MOO_NULL; @@ -382,18 +398,27 @@ void hcl_setsynerrbfmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, } } -void hcl_setsynerrufmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, const moo_oocs_t* tgt, const moo_uch_t* msgfmt, ...) +void moo_setsynerrufmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, const moo_oocs_t* tgt, const moo_uch_t* msgfmt, ...) { + static moo_bch_t syntax_error[] = "syntax error - "; + if (msgfmt) { va_list ap; + int i, selen; + va_start (ap, msgfmt); moo_seterrufmtv (moo, MOO_ESYNERR, msgfmt, ap); va_end (ap); + + selen = MOO_COUNTOF(syntax_error) - 1; + MOO_MEMMOVE (&moo->errmsg.buf[selen], &moo->errmsg.buf[0], MOO_SIZEOF(moo->errmsg.buf[0]) * (MOO_COUNTOF(moo->errmsg.buf) - selen)); + for (i = 0; i < selen; i++) moo->errmsg.buf[i] = syntax_error[i]; + moo->errmsg.buf[MOO_COUNTOF(moo->errmsg.buf) - 1] = '\0'; } else { - moo_seterrbfmt (moo, MOO_ESYNERR, "syntax error - %js", synerr_to_errstr(num)); + moo_seterrbfmt (moo, MOO_ESYNERR, "%hs%js", syntax_error, synerr_to_errstr(num)); } moo->c->synerr.num = num; @@ -403,11 +428,18 @@ void hcl_setsynerrufmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, * moo->c->tok.loc due to 'const' prefixed to loc. */ /*moo->c->synerr.loc = loc? *loc: moo->c->tok.loc;*/ if (loc) + { moo->c->synerr.loc = *loc; + } else + { moo->c->synerr.loc = moo->c->tok.loc; - - if (tgt) moo->c->synerr.tgt = *tgt; + } + + if (tgt) + { + moo->c->synerr.tgt = *tgt; + } else { moo->c->synerr.tgt.ptr = MOO_NULL; @@ -415,9 +447,9 @@ void hcl_setsynerrufmt (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, } } -void hcl_setsynerr (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, const moo_oocs_t* tgt) +void moo_setsynerr (moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, const moo_oocs_t* tgt) { - hcl_setsynerrbfmt (moo, num, loc, tgt, MOO_NULL); + moo_setsynerrbfmt (moo, num, loc, tgt, MOO_NULL); } #endif diff --git a/moo/lib/main.c b/moo/lib/main.c index e176c02..f24387a 100644 --- a/moo/lib/main.c +++ b/moo/lib/main.c @@ -417,7 +417,7 @@ static MOO_INLINE moo_ooi_t close_input (moo_t* moo, moo_ioarg_t* arg) static MOO_INLINE moo_ooi_t read_input (moo_t* moo, moo_ioarg_t* arg) { - /*xtn_t* xtn = hcl_getxtn(hcl);*/ + /*xtn_t* xtn = moo_getxtn(hcl);*/ bb_t* bb; moo_oow_t bcslen, ucslen, remlen; int x; diff --git a/moo/lib/moo-prv.h b/moo/lib/moo-prv.h index 18bf6ea..6c8ef63 100644 --- a/moo/lib/moo-prv.h +++ b/moo/lib/moo-prv.h @@ -994,7 +994,7 @@ void moo_seterrufmtv ( #if defined(MOO_INCLUDE_COMPILER) -void hcl_setsynerrbfmt ( +void moo_setsynerrbfmt ( moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, @@ -1003,7 +1003,7 @@ void hcl_setsynerrbfmt ( ... ); -void hcl_setsynerrufmt ( +void moo_setsynerrufmt ( moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc, @@ -1012,7 +1012,7 @@ void hcl_setsynerrufmt ( ... ); -void hcl_setsynerr ( +void moo_setsynerr ( moo_t* moo, moo_synerrnum_t num, const moo_ioloc_t* loc,