summaryrefslogtreecommitdiff
path: root/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'print.c')
-rw-r--r--print.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/print.c b/print.c
index b8b617d..55da3b3 100644
--- a/print.c
+++ b/print.c
@@ -186,15 +186,21 @@ ppoperator(Operator op)
Rune *right = op.right ? ppdatum(op.right) : runestrdup(L"");
Rune *res;
if(op.type == OperatortypeDop)
- res = runesmprint("(%S{%S}%S)", left, op.dop, right);
+ res = runesmprint("%S{%S}%S", left, op.dop, right);
else if(op.type == OperatortypeHybrid){
- res = runesmprint("(%S%C)", left, primhybridnames[op.code]);
+ res = runesmprint("%S%C", left, primhybridnames[op.code]);
}else{
- res = runesmprint("(%S%C%S)",
+ res = runesmprint("%S%C%S",
left,
op.dyadic ? primdyadopnames[op.code] : primmonopnames[op.code],
right);
}
+ if(op.left || op.right){
+ Rune *tmp = res;
+ res = runesmprint("(%S)", res);
+ free(tmp);
+ }
+
free(left);
free(right);
return res;