fix op error handling.

This commit is contained in:
Vitor Santos Costa 2010-02-26 12:03:32 +00:00
parent 0e9a98fa30
commit 97a3897c88
1 changed files with 10 additions and 2 deletions

View File

@ -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),