fix op error handling.
This commit is contained in:
parent
0e9a98fa30
commit
97a3897c88
12
pl/utils.yap
12
pl/utils.yap
|
@ -37,10 +37,10 @@ op(P,T,V) :-
|
||||||
'$do_error'(type_error(atom,T),G)
|
'$do_error'(type_error(atom,T),G)
|
||||||
;
|
;
|
||||||
P < 0 ->
|
P < 0 ->
|
||||||
'$do_error'(domain_error(out_of_range,P),G)
|
'$do_error'(domain_error(operator_priority,P),G)
|
||||||
;
|
;
|
||||||
P > 1200 ->
|
P > 1200 ->
|
||||||
'$do_error'(domain_error(out_of_range,P),G)
|
'$do_error'(domain_error(operator_priority,P),G)
|
||||||
;
|
;
|
||||||
\+ '$associativity'(T) ->
|
\+ '$associativity'(T) ->
|
||||||
'$do_error'(domain_error(operator_specifier,T),G)
|
'$do_error'(domain_error(operator_specifier,T),G)
|
||||||
|
@ -115,6 +115,10 @@ current_op(X,Y,Z) :-
|
||||||
'$do_current_op'(X,Y,Z,M).
|
'$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) :-
|
'$current_opm'(X,Y,Z,M) :-
|
||||||
var(Z), !,
|
var(Z), !,
|
||||||
'$do_current_op'(X,Y,Z,M).
|
'$do_current_op'(X,Y,Z,M).
|
||||||
|
@ -123,6 +127,10 @@ current_op(X,Y,Z) :-
|
||||||
'$current_opm'(X,Y,Z,M) :-
|
'$current_opm'(X,Y,Z,M) :-
|
||||||
'$do_current_op'(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) :-
|
'$do_current_op'(X,Y,Z,M) :-
|
||||||
atom(Z), !,
|
atom(Z), !,
|
||||||
'$current_atom_op'(Z, M1, Prefix, Infix, Posfix),
|
'$current_atom_op'(Z, M1, Prefix, Infix, Posfix),
|
||||||
|
|
Reference in New Issue