diff options
author | Unknown <t-jasonk@Z3507288.redmond.corp.microsoft.com> | 2012-05-31 17:13:35 -0700 |
---|---|---|
committer | Unknown <t-jasonk@Z3507288.redmond.corp.microsoft.com> | 2012-05-31 17:13:35 -0700 |
commit | 57a7fa3aa01ced1943dde6fe3270c62f1b6923c3 (patch) | |
tree | 35d0616be8e25e644a9283732b17e87ed1c17e35 /Source/Dafny/Printer.cs | |
parent | df71b461ff9284991c06b04d17b6e6b50f8151ae (diff) |
Dafny: Added map comprehensions and updated display syntax
Diffstat (limited to 'Source/Dafny/Printer.cs')
-rw-r--r-- | Source/Dafny/Printer.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Dafny/Printer.cs b/Source/Dafny/Printer.cs index 38ec17fc..6cf71fa1 100644 --- a/Source/Dafny/Printer.cs +++ b/Source/Dafny/Printer.cs @@ -1190,6 +1190,24 @@ namespace Microsoft.Dafny { }
if (parensNeeded) { wr.Write(")"); }
+ } else if (expr is MapComprehension) {
+ var e = (MapComprehension)expr;
+ bool parensNeeded = !isRightmost;
+ if (parensNeeded) { wr.Write("("); }
+ wr.Write("map ");
+ string sep = "";
+ foreach (BoundVar bv in e.BoundVars) {
+ wr.Write("{0}{1}", sep, bv.Name);
+ sep = ", ";
+ PrintType(": ", bv.Type);
+ }
+ PrintAttributes(e.Attributes);
+ wr.Write(" | ");
+ PrintExpression(e.Range);
+ wr.Write(" :: ");
+ PrintExpression(e.Term);
+ if (parensNeeded) { wr.Write(")"); }
+
} else if (expr is WildcardExpr) {
wr.Write("*");
|