[parser] update of some error messages

This commit is contained in:
Arnaud DABY-SEESARAM 2022-12-20 14:10:34 +01:00
parent c7edb27fb0
commit 42536df81c

View File

@ -313,15 +313,15 @@ expr:
| MO_pre expr { EMonOp (type_exp $2, MOp_pre, $2) } | MO_pre expr { EMonOp (type_exp $2, MOp_pre, $2) }
| MINUS expr | MINUS expr
{ monop_neg_condition $2 [TBool] { monop_neg_condition $2 [TBool]
"You cannot take the opposite of a boolean expression." "You cannot take the opposite of an expression that is not a number."
(EMonOp (type_exp $2, MOp_minus, $2)) } (EMonOp (type_exp $2, MOp_minus, $2)) }
| PLUS expr | PLUS expr
{ monop_neg_condition $2 [TBool] { monop_neg_condition $2 [TBool]
"You cannot take the plus of a boolean expression." $2 } "(+) expects its argument to be a number." $2 }
/* Binary operators */ /* Binary operators */
| expr PLUS expr | expr PLUS expr
{ make_binop_nonbool $1 $3 BOp_add { make_binop_nonbool $1 $3 BOp_add
"You should know better; addition hates booleans" } "Addition expects both arguments to be (the same kind of) numbers." }
| expr MINUS expr | expr MINUS expr
{ make_binop_nonbool $1 $3 BOp_sub { make_binop_nonbool $1 $3 BOp_sub
"You should know better; subtraction hates booleans" } "You should know better; subtraction hates booleans" }