summaryrefslogtreecommitdiff
path: root/Source/Dafny/Printer.cs
diff options
context:
space:
mode:
authorGravatar Nadia Polikarpova <nadia.polikarpova@gmail.com>2013-02-14 00:06:28 +0100
committerGravatar Nadia Polikarpova <nadia.polikarpova@gmail.com>2013-02-14 00:06:28 +0100
commit29aa0357017c1d23deedbf18995a6863e11ac07d (patch)
treec44f7b5657fc3997ecebf61441b29b295f33ddc3 /Source/Dafny/Printer.cs
parent28c4fb214c52fece625da53cfe8cc62b67bf4dca (diff)
First take on calc expressions.
Diffstat (limited to 'Source/Dafny/Printer.cs')
-rw-r--r--Source/Dafny/Printer.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Dafny/Printer.cs b/Source/Dafny/Printer.cs
index 8630d122..d3847f10 100644
--- a/Source/Dafny/Printer.cs
+++ b/Source/Dafny/Printer.cs
@@ -1383,6 +1383,16 @@ namespace Microsoft.Dafny {
PrintExpression(e.Body);
if (parensNeeded) { wr.Write(")"); }
+ } else if (expr is CalcExpr) {
+ var e = (CalcExpr)expr;
+ bool parensNeeded = !isRightmost;
+ if (parensNeeded) { wr.Write("("); }
+ PrintStatement(e.Guard, indent);
+ wr.WriteLine();
+ Indent(indent);
+ PrintExpression(e.Body);
+ if (parensNeeded) { wr.Write(")"); }
+
} else if (expr is ITEExpr) {
ITEExpr ite = (ITEExpr)expr;
bool parensNeeded = !isRightmost;