minor error message changes
This commit is contained in:
parent
70f759b140
commit
47cea947db
@ -142,13 +142,13 @@ const hawk_ooch_t* hawk_dfl_errstr (hawk_errnum_t errnum)
|
|||||||
HAWK_T("right-hand side of the 'in' operator not a map"),
|
HAWK_T("right-hand side of the 'in' operator not a map"),
|
||||||
HAWK_T("right-hand side of the 'in' operator not a map nor nil"),
|
HAWK_T("right-hand side of the 'in' operator not a map nor nil"),
|
||||||
HAWK_T("value not referenceable"),
|
HAWK_T("value not referenceable"),
|
||||||
HAWK_T("cannot return a non-scalar value"), /* ENONSCARET */
|
HAWK_T("cannot return a nonscalar value"), /* ENONSCARET */
|
||||||
HAWK_T("cannot assign a non-scalar value to a positional"), /* ENONSCATOPOS */
|
HAWK_T("cannot assign a nonscalar value to a positional"), /* ENONSCATOPOS */
|
||||||
HAWK_T("cannot assign a non-scalar value to an indexed variable"),/* ENONSCATOIDX */
|
HAWK_T("cannot assign a nonscalar value to an indexed variable"),/* ENONSCATOIDX */
|
||||||
HAWK_T("cannot assign a non-scalar value to a variable"), /* ENONSCATOVAR */
|
HAWK_T("cannot assign a nonscalar value to a variable"), /* ENONSCATOVAR */
|
||||||
HAWK_T("cannot change a non-scalar value to a scalar value"), /* ENONSCATOSCALAR */
|
HAWK_T("cannot change a nonscalar value to a scalar value"), /* ENONSCATOSCALAR */
|
||||||
HAWK_T("cannot change a non-scalar value to another non-scalar value"), /* ENONSCATONONSCA */
|
HAWK_T("cannot change a nonscalar value to another nonscalar value"), /* ENONSCATONONSCA */
|
||||||
HAWK_T("cannot change a scalar value to a non-scalar value"), /* ESCALARTONONSCA */
|
HAWK_T("cannot change a scalar value to a nonscalar value"), /* ESCALARTONONSCA */
|
||||||
HAWK_T("invalid value to convert to a string"),
|
HAWK_T("invalid value to convert to a string"),
|
||||||
HAWK_T("invalid value to convert to a number"),
|
HAWK_T("invalid value to convert to a number"),
|
||||||
HAWK_T("invalid value to a character"),
|
HAWK_T("invalid value to a character"),
|
||||||
|
@ -977,13 +977,13 @@ enum hawk_errnum_t
|
|||||||
HAWK_ENOTMAPIN, /**< right-hand side of 'in' not a map */
|
HAWK_ENOTMAPIN, /**< right-hand side of 'in' not a map */
|
||||||
HAWK_ENOTMAPNILIN, /**< right-hand side of 'in' not a map nor nil */
|
HAWK_ENOTMAPNILIN, /**< right-hand side of 'in' not a map nor nil */
|
||||||
HAWK_ENOTREF, /**< value not referenceable */
|
HAWK_ENOTREF, /**< value not referenceable */
|
||||||
HAWK_ENONSCARET, /**< non-scalar value cannot be returned */
|
HAWK_ENONSCARET, /**< nonscalar value cannot be returned */
|
||||||
HAWK_ENONSCATOPOS, /**< non-scalar value cannot be assigned to a positional */
|
HAWK_ENONSCATOPOS, /**< nonscalar value cannot be assigned to a positional */
|
||||||
HAWK_ENONSCATOIDX, /**< non-scalar value cannot be assigned to an indexed variable */
|
HAWK_ENONSCATOIDX, /**< nonscalar value cannot be assigned to an indexed variable */
|
||||||
HAWK_ENONSCATOVAR, /**< non-scalar cannot be assigned to a variable */
|
HAWK_ENONSCATOVAR, /**< nonscalar cannot be assigned to a variable */
|
||||||
HAWK_ENONSCATOSCALAR, /**< cannot change a non-scalar value to a scalar value */
|
HAWK_ENONSCATOSCALAR, /**< cannot change a nonscalar value to a scalar value */
|
||||||
HAWK_ENONSCATONONSCA, /**< cannot change a non-scalar value to another non-scalar value */
|
HAWK_ENONSCATONONSCA, /**< cannot change a nonscalar value to another nonscalar value */
|
||||||
HAWK_ESCALARTONONSCA, /**< cannot change a scalar value to to a non-scalar value */
|
HAWK_ESCALARTONONSCA, /**< cannot change a scalar value to to a nonscalar value */
|
||||||
HAWK_EVALTOSTR, /**< invalid value to convert to a string */
|
HAWK_EVALTOSTR, /**< invalid value to convert to a string */
|
||||||
HAWK_EVALTONUM, /**< invalid value to convert to a number */
|
HAWK_EVALTONUM, /**< invalid value to convert to a number */
|
||||||
HAWK_EVALTOCHR, /**< invalid value to convert to a character */
|
HAWK_EVALTOCHR, /**< invalid value to convert to a character */
|
||||||
|
@ -116,12 +116,8 @@ static int run_reset (hawk_rtx_t* rtx, hawk_nde_reset_t* nde);
|
|||||||
static int run_print (hawk_rtx_t* rtx, hawk_nde_print_t* nde);
|
static int run_print (hawk_rtx_t* rtx, hawk_nde_print_t* nde);
|
||||||
static int run_printf (hawk_rtx_t* rtx, hawk_nde_print_t* nde);
|
static int run_printf (hawk_rtx_t* rtx, hawk_nde_print_t* nde);
|
||||||
|
|
||||||
static int output_formatted (
|
static int output_formatted (hawk_rtx_t* run, int out_type, const hawk_ooch_t* dst, const hawk_ooch_t* fmt, hawk_oow_t fmt_len, hawk_nde_t* args);
|
||||||
hawk_rtx_t* run, int out_type, const hawk_ooch_t* dst,
|
static int output_formatted_bytes (hawk_rtx_t* run, int out_type, const hawk_ooch_t* dst, const hawk_bch_t* fmt, hawk_oow_t fmt_len, hawk_nde_t* args);
|
||||||
const hawk_ooch_t* fmt, hawk_oow_t fmt_len, hawk_nde_t* args);
|
|
||||||
static int output_formatted_bytes (
|
|
||||||
hawk_rtx_t* run, int out_type, const hawk_ooch_t* dst,
|
|
||||||
const hawk_bch_t* fmt, hawk_oow_t fmt_len, hawk_nde_t* args);
|
|
||||||
|
|
||||||
static hawk_val_t* eval_expression (hawk_rtx_t* rtx, hawk_nde_t* nde);
|
static hawk_val_t* eval_expression (hawk_rtx_t* rtx, hawk_nde_t* nde);
|
||||||
static hawk_val_t* eval_expression0 (hawk_rtx_t* rtx, hawk_nde_t* nde);
|
static hawk_val_t* eval_expression0 (hawk_rtx_t* rtx, hawk_nde_t* nde);
|
||||||
@ -276,7 +272,7 @@ static int set_global (hawk_rtx_t* rtx, int idx, hawk_nde_var_t* var, hawk_val_t
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
errnum = HAWK_ESCALARTONONSCA;
|
errnum = HAWK_ESCALARTONONSCA;
|
||||||
errfmt = HAWK_T("not allowed to change a scalar value in '%.*js' to a non-scalar value");
|
errfmt = HAWK_T("not allowed to change a scalar value in '%.*js' to a nonscalar value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -284,7 +280,7 @@ static int set_global (hawk_rtx_t* rtx, int idx, hawk_nde_var_t* var, hawk_val_t
|
|||||||
if (old_vtype == HAWK_VAL_MAP || old_vtype == HAWK_VAL_ARR)
|
if (old_vtype == HAWK_VAL_MAP || old_vtype == HAWK_VAL_ARR)
|
||||||
{
|
{
|
||||||
errnum = HAWK_ENONSCATOSCALAR;
|
errnum = HAWK_ENONSCATOSCALAR;
|
||||||
errfmt = HAWK_T("not allowed to change a non-scalar value in '%.*js' to a scalar value");
|
errfmt = HAWK_T("not allowed to change a nonscalar value in '%.*js' to a scalar value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +319,7 @@ static int set_global (hawk_rtx_t* rtx, int idx, hawk_nde_var_t* var, hawk_val_t
|
|||||||
|
|
||||||
hawk_oocs_t ea;
|
hawk_oocs_t ea;
|
||||||
ea.ptr = (hawk_ooch_t*)hawk_getgblname(hawk_rtx_gethawk(rtx), idx, &ea.len);
|
ea.ptr = (hawk_ooch_t*)hawk_getgblname(hawk_rtx_gethawk(rtx), idx, &ea.len);
|
||||||
hawk_rtx_seterrfmt (rtx, HAWK_NULL, HAWK_ESCALARTONONSCA, HAWK_T("not allowed to change a scalar value in '%.*js' to a non-scalar value"), ea.len, ea.ptr);
|
hawk_rtx_seterrfmt (rtx, HAWK_NULL, HAWK_ESCALARTONONSCA, HAWK_T("not allowed to change a scalar value in '%.*js' to a nonscalar value"), ea.len, ea.ptr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3124,6 +3120,7 @@ static int run_delete (hawk_rtx_t* rtx, hawk_nde_delete_t* nde)
|
|||||||
hawk_arr_clear (((hawk_val_arr_t*)val)->arr);
|
hawk_arr_clear (((hawk_val_arr_t*)val)->arr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENOTDEL, HAWK_T("'%.*js' not deletable"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENOTDEL, HAWK_T("'%.*js' not deletable"), var->id.name.len, var->id.name.ptr);
|
||||||
goto oops;
|
goto oops;
|
||||||
@ -3841,16 +3838,16 @@ static hawk_val_t* do_assignment_nonidx (hawk_rtx_t* rtx, hawk_nde_var_t* var, h
|
|||||||
{
|
{
|
||||||
/* old value is a map - it can only be accessed through indexing. */
|
/* old value is a map - it can only be accessed through indexing. */
|
||||||
if (vtype == old_vtype)
|
if (vtype == old_vtype)
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATONONSCA, HAWK_T("not allowed to change a non-scalar value in '%.*js' to another non-scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATONONSCA, HAWK_T("not allowed to change a nonscalar value in '%.*js' to another nonscalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
else
|
else
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOSCALAR, HAWK_T("not allowed to change a non-scalar value in '%.*js' to a scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOSCALAR, HAWK_T("not allowed to change a nonscalar value in '%.*js' to a scalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
else if (vtype == HAWK_VAL_MAP || vtype == HAWK_VAL_ARR)
|
else if (vtype == HAWK_VAL_MAP || vtype == HAWK_VAL_ARR)
|
||||||
{
|
{
|
||||||
/* old value is not a map but a new value is a map.
|
/* old value is not a map but a new value is a map.
|
||||||
* a map cannot be assigned to a variable if FLEXMAP is off. */
|
* a map cannot be assigned to a variable if FLEXMAP is off. */
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOVAR, HAWK_T("not allowed to assign a non-scalar value to a variable '%.*js'"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOVAR, HAWK_T("not allowed to assign a nonscalar value to a variable '%.*js'"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3887,16 +3884,16 @@ static hawk_val_t* do_assignment_nonidx (hawk_rtx_t* rtx, hawk_nde_var_t* var, h
|
|||||||
{
|
{
|
||||||
/* old value is a map - it can only be accessed through indexing. */
|
/* old value is a map - it can only be accessed through indexing. */
|
||||||
if (vtype == old_type)
|
if (vtype == old_type)
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATONONSCA, HAWK_T("not allowed to change a non-scalar value in '%.*js' to another non-scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATONONSCA, HAWK_T("not allowed to change a nonscalar value in '%.*js' to another nonscalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
else
|
else
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOSCALAR, HAWK_T("not allowed to change a non-scalar value in '%.*js' to a scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOSCALAR, HAWK_T("not allowed to change a nonscalar value in '%.*js' to a scalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
else if (vtype == HAWK_VAL_MAP || vtype == HAWK_VAL_ARR)
|
else if (vtype == HAWK_VAL_MAP || vtype == HAWK_VAL_ARR)
|
||||||
{
|
{
|
||||||
/* old value is not a map but a new value is a map.
|
/* old value is not a map but a new value is a map.
|
||||||
* a map cannot be assigned to a variable if FLEXMAP is off. */
|
* a map cannot be assigned to a variable if FLEXMAP is off. */
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOVAR, HAWK_T("not allowed to assign a non-scalar value to a variable '%.*js'"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOVAR, HAWK_T("not allowed to assign a nonscalar value to a variable '%.*js'"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3919,16 +3916,16 @@ static hawk_val_t* do_assignment_nonidx (hawk_rtx_t* rtx, hawk_nde_var_t* var, h
|
|||||||
{
|
{
|
||||||
/* old value is a map - it can only be accessed through indexing. */
|
/* old value is a map - it can only be accessed through indexing. */
|
||||||
if (vtype == old_type)
|
if (vtype == old_type)
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATONONSCA, HAWK_T("not allowed to change a non-scalar value in '%.*js' to another non-scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATONONSCA, HAWK_T("not allowed to change a nonscalar value in '%.*js' to another nonscalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
else
|
else
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOSCALAR, HAWK_T("not allowed to change a non-scalar value in '%.*js' to a scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOSCALAR, HAWK_T("not allowed to change a nonscalar value in '%.*js' to a scalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
else if (vtype == HAWK_VAL_MAP || vtype == HAWK_VAL_ARR)
|
else if (vtype == HAWK_VAL_MAP || vtype == HAWK_VAL_ARR)
|
||||||
{
|
{
|
||||||
/* old value is not a map but a new value is a map.
|
/* old value is not a map but a new value is a map.
|
||||||
* a map cannot be assigned to a variable if FLEXMAP is off. */
|
* a map cannot be assigned to a variable if FLEXMAP is off. */
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOVAR, HAWK_T("not allowed to assign a non-scalar value to a variable '%.*js'"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ENONSCATOVAR, HAWK_T("not allowed to assign a nonscalar value to a variable '%.*js'"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4022,7 +4019,7 @@ static hawk_val_t* do_assignment_idx (hawk_rtx_t* rtx, hawk_nde_var_t* var, hawk
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ESCALARTONONSCA, HAWK_T("not allowed to change a nested scalar value under '%.*js' to a non-scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ESCALARTONONSCA, HAWK_T("not allowed to change a nested scalar value under '%.*js' to a nonscalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
goto oops_map;
|
goto oops_map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4079,7 +4076,7 @@ static hawk_val_t* do_assignment_idx (hawk_rtx_t* rtx, hawk_nde_var_t* var, hawk
|
|||||||
{
|
{
|
||||||
/* you can't manipulate a variable pointing to
|
/* you can't manipulate a variable pointing to
|
||||||
* a scalar value with an index if FLEXMAP is off. */
|
* a scalar value with an index if FLEXMAP is off. */
|
||||||
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ESCALARTONONSCA, HAWK_T("not allowed to change a scalar value in '%.*js' to a non-scalar value"), var->id.name.len, var->id.name.ptr);
|
hawk_rtx_seterrfmt (rtx, &var->loc, HAWK_ESCALARTONONSCA, HAWK_T("not allowed to change a scalar value in '%.*js' to a nonscalar value"), var->id.name.len, var->id.name.ptr);
|
||||||
return HAWK_NULL;
|
return HAWK_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user