From 97a3897c88e9dc5a24cc3eebfac489d0739c65d0 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 26 Feb 2010 12:03:32 +0000 Subject: [PATCH] fix op error handling. --- pl/utils.yap | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pl/utils.yap b/pl/utils.yap index 737a877c1..98f23fe1e 100644 --- a/pl/utils.yap +++ b/pl/utils.yap @@ -37,10 +37,10 @@ op(P,T,V) :- '$do_error'(type_error(atom,T),G) ; P < 0 -> - '$do_error'(domain_error(out_of_range,P),G) + '$do_error'(domain_error(operator_priority,P),G) ; P > 1200 -> - '$do_error'(domain_error(out_of_range,P),G) + '$do_error'(domain_error(operator_priority,P),G) ; \+ '$associativity'(T) -> '$do_error'(domain_error(operator_specifier,T),G) @@ -115,6 +115,10 @@ current_op(X,Y,Z) :- '$do_current_op'(X,Y,Z,M). +'$current_opm'(X,Y,Z,M) :- + nonvar(Y), + \+ '$associativity'(Y), + '$do_error'(domain_error(operator_specifier,Y),current_op(X,Y,M:Z)). '$current_opm'(X,Y,Z,M) :- var(Z), !, '$do_current_op'(X,Y,Z,M). @@ -123,6 +127,10 @@ current_op(X,Y,Z) :- '$current_opm'(X,Y,Z,M) :- '$do_current_op'(X,Y,Z,M). +'$do_current_op'(X,Y,Z,M) :- + nonvar(Y), + \+ '$associativity'(Y), + '$do_error'(domain_error(operator_specifier,Y),current_op(X,Y,M:Z)). '$do_current_op'(X,Y,Z,M) :- atom(Z), !, '$current_atom_op'(Z, M1, Prefix, Infix, Posfix),