| Expr_eq of whenexpr * whenexpr
| Expr_ge of whenexpr * whenexpr
| Expr_gt of whenexpr * whenexpr
+ | Expr_ne of whenexpr * whenexpr
| Expr_not of whenexpr
| Expr_add of whenexpr * whenexpr
| Expr_sub of whenexpr * whenexpr
| IExpr_app (">", exprs) ->
two_params _loc ">" exprs (fun e1 e2 -> Expr_gt (e1, e2))
+ | IExpr_app (("!="|"<>"), exprs) ->
+ two_params _loc "<>" exprs (fun e1 e2 -> Expr_ne (e1, e2))
+
| IExpr_app ("!", exprs) ->
one_param _loc "!" exprs (fun e1 -> Expr_not e1)
sprintf "%s >= %s" (string_of_whenexpr e1) (string_of_whenexpr e2)
| Expr_gt (e1, e2) ->
sprintf "%s > %s" (string_of_whenexpr e1) (string_of_whenexpr e2)
+ | Expr_ne (e1, e2) ->
+ sprintf "%s <> %s" (string_of_whenexpr e1) (string_of_whenexpr e2)
| Expr_not e -> sprintf "! %s" (string_of_whenexpr e)
| Expr_add (e1, e2) ->
sprintf "%s + %s" (string_of_whenexpr e1) (string_of_whenexpr e2)
| Expr_eq (e1, e2)
| Expr_ge (e1, e2)
| Expr_gt (e1, e2)
+ | Expr_ne (e1, e2)
| Expr_add (e1, e2)
| Expr_sub (e1, e2)
| Expr_mul (e1, e2)
else
T_bool false
+ | Expr_ne (e1, e2) ->
+ let e1 = eval_whenexpr variables prev_variables onload e1
+ and e2 = eval_whenexpr variables prev_variables onload e2 in
+ if compare_values e1 e2 <> 0 then
+ T_bool true
+ else
+ T_bool false
+
| Expr_not e ->
if not (eval_whenexpr_as_bool variables prev_variables onload e) then
T_bool true
| Expr_eq of whenexpr * whenexpr (** == *)
| Expr_ge of whenexpr * whenexpr (** >= *)
| Expr_gt of whenexpr * whenexpr (** > *)
+ | Expr_ne of whenexpr * whenexpr (** != *)
| Expr_not of whenexpr (** boolean not *)
| Expr_add of whenexpr * whenexpr (** arithmetic addition or string cat *)
| Expr_sub of whenexpr * whenexpr (** arithmetic subtraction *)
If either sub-expression is non-numeric, then both expressions are
converted (if necessary) to strings and string comparison is done.
+=item I<expr> B<E<lt>E<gt>> I<expr>
+
+=item I<expr> B<!=> I<expr>
+
+Either form can be used to test the two expressions for inequality.
+
=item B<!> I<expr>
Boolean negative of I<expr>.