shorten needs_bracketing/2

This commit is contained in:
Markus Triska
2023-06-30 18:01:54 +02:00
parent 28065b0565
commit bfe808a779

View File

@@ -211,16 +211,12 @@ needs_bracketing(Value, Op) :-
current_op(FPrec, FSpec, F), current_op(FPrec, FSpec, F),
current_op(EqPrec, EqSpec, Op), current_op(EqPrec, EqSpec, Op),
arity_specifier(Arity, FSpec), arity_specifier(Arity, FSpec),
( Arity =:= 0 -> ( Arity =:= 0
true ; EqPrec < FPrec
; EqPrec < FPrec -> ; FPrec > 0, F == Value, graphic_token_char(F)
true ; F \== '.', '$quoted_token'(F)
; FPrec > 0, F == Value, graphic_token_char(F) -> ; EqPrec =:= FPrec,
true member(EqSpec, [fx,xfx,yfx])
; F \== '.', '$quoted_token'(F) ->
true
; EqPrec == FPrec,
memberchk(EqSpec, [fx,xfx,yfx])
). ).
arity_specifier(0, _). arity_specifier(0, _).