summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar rustanleino <unknown>2010-01-14 22:20:49 +0000
committerGravatar rustanleino <unknown>2010-01-14 22:20:49 +0000
commitc0eedb936ceb9de75cd64d7eb81805a4cc9c64b4 (patch)
treefbd9dced80ca9f2b4054c5cc4358f749106a1482
parent9f5bb9b92d843b3718673545a62791f5049a7d74 (diff)
Dafny:
* Allow (and currently ignore) "ghost" modifier. * Fixed bug in boxing. * Check for div-by-zero error for modulo operator. * Improved emacs and latex modes.
-rw-r--r--Dafny/Dafny.atg2
-rw-r--r--Dafny/Parser.ssc771
-rw-r--r--Dafny/Scanner.ssc169
-rw-r--r--Dafny/Translator.ssc12
-rw-r--r--Util/Emacs/dafny-mode.el2
-rw-r--r--Util/latex/dafny.sty10
6 files changed, 496 insertions, 470 deletions
diff --git a/Dafny/Dafny.atg b/Dafny/Dafny.atg
index 265ae01b..77eba938 100644
--- a/Dafny/Dafny.atg
+++ b/Dafny/Dafny.atg
@@ -179,6 +179,7 @@ FieldDecl<List<MemberDecl!\>! mm>
= (. Attributes attrs = null;
Token! id; Type! ty;
.)
+ [ "ghost" ]
"var"
{ Attribute<ref attrs> }
IdentType<out id, out ty> (. mm.Add(new Field(id, id.val, ty, attrs)); .)
@@ -589,6 +590,7 @@ LhsExpr<out Expression! e>
VarDeclStmts<List<Statement!\>! ss>
= (. VarDecl! d; .)
+ [ "ghost" ]
"var"
IdentTypeRhs<out d> (. ss.Add(d); parseVarScope.Push(d.Name, d.Name); .)
{ "," IdentTypeRhs<out d> (. ss.Add(d); parseVarScope.Push(d.Name, d.Name); .)
diff --git a/Dafny/Parser.ssc b/Dafny/Parser.ssc
index 5180d413..930aa2bf 100644
--- a/Dafny/Parser.ssc
+++ b/Dafny/Parser.ssc
@@ -5,7 +5,7 @@ using Microsoft.Contracts;
namespace Microsoft.Dafny {
public class Parser {
- const int maxT = 92;
+ const int maxT = 93;
const bool T = true;
const bool x = false;
@@ -155,7 +155,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Attribute(ref attrs);
}
Ident(out id);
- if (t.kind == 12) {
+ if (t.kind == 13) {
GenericParameters(typeArgs);
}
Expect(5);
@@ -177,7 +177,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Attribute(ref attrs);
}
Ident(out id);
- if (t.kind == 12) {
+ if (t.kind == 13) {
GenericParameters(typeArgs);
}
Expect(5);
@@ -201,45 +201,48 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void GenericParameters(List<TypeParameter!>! typeArgs) {
Token! id;
- Expect(12);
+ Expect(13);
Ident(out id);
typeArgs.Add(new TypeParameter(id, id.val));
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
Ident(out id);
typeArgs.Add(new TypeParameter(id, id.val));
}
- Expect(13);
+ Expect(14);
}
static void ClassMemberDecl(List<MemberDecl!>! mm) {
Method! m;
Function! f;
- if (t.kind == 9) {
+ if (t.kind == 9 || t.kind == 10) {
FieldDecl(mm);
- } else if (t.kind == 28) {
+ } else if (t.kind == 29) {
FunctionDecl(out f);
mm.Add(f);
- } else if (t.kind == 15) {
+ } else if (t.kind == 16) {
MethodDecl(out m);
mm.Add(m);
- } else if (t.kind == 14) {
+ } else if (t.kind == 15) {
FrameDecl();
- } else Error(93);
+ } else Error(94);
}
static void FieldDecl(List<MemberDecl!>! mm) {
Attributes attrs = null;
Token! id; Type! ty;
- Expect(9);
+ if (t.kind == 9) {
+ Get();
+ }
+ Expect(10);
while (t.kind == 5) {
Attribute(ref attrs);
}
IdentType(out id, out ty);
mm.Add(new Field(id, id.val, ty, attrs));
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
IdentType(out id, out ty);
mm.Add(new Field(id, id.val, ty, attrs));
@@ -259,34 +262,34 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Expression! bb; Expression body = null;
bool use = false;
- Expect(28);
+ Expect(29);
while (t.kind == 5) {
Attribute(ref attrs);
}
- if (t.kind == 29) {
+ if (t.kind == 30) {
Get();
use = true;
}
Ident(out id);
- if (t.kind == 12) {
+ if (t.kind == 13) {
GenericParameters(typeArgs);
}
parseVarScope.PushMarker();
Formals(true, formals);
- Expect(11);
+ Expect(12);
Type(out returnType);
if (t.kind == 8) {
Get();
- while (t.kind == 19 || t.kind == 30 || t.kind == 31) {
+ while (t.kind == 20 || t.kind == 31 || t.kind == 32) {
FunctionSpec(reqs, reads, decreases);
}
} else if (StartOf(2)) {
- while (t.kind == 19 || t.kind == 30 || t.kind == 31) {
+ while (t.kind == 20 || t.kind == 31 || t.kind == 32) {
FunctionSpec(reqs, reads, decreases);
}
FunctionBody(out bb);
body = bb;
- } else Error(94);
+ } else Error(95);
parseVarScope.PopMarker();
f = new Function(id, id.val, use, typeArgs, formals, returnType, reqs, reads, decreases, body, attrs);
@@ -303,17 +306,17 @@ public static int Parse (List<TopLevelDecl!>! classes) {
List<MaybeFreeExpression!> ens = new List<MaybeFreeExpression!>();
Statement! bb; Statement body = null;
- Expect(15);
+ Expect(16);
while (t.kind == 5) {
Attribute(ref attrs);
}
Ident(out id);
- if (t.kind == 12) {
+ if (t.kind == 13) {
GenericParameters(typeArgs);
}
parseVarScope.PushMarker();
Formals(true, ins);
- if (t.kind == 16) {
+ if (t.kind == 17) {
Get();
Formals(false, outs);
}
@@ -328,7 +331,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
BlockStmt(out bb);
body = bb;
- } else Error(95);
+ } else Error(96);
parseVarScope.PopMarker();
m = new Method(id, id.val, typeArgs, ins, outs, req, mod, ens, body, attrs);
@@ -338,7 +341,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Token! id;
Attributes attrs = null;
- Expect(14);
+ Expect(15);
while (t.kind == 5) {
Attribute(ref attrs);
}
@@ -357,11 +360,11 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Attribute(ref attrs);
}
Ident(out id);
- if (t.kind == 12) {
+ if (t.kind == 13) {
GenericParameters(typeArgs);
}
parseVarScope.PushMarker();
- if (t.kind == 21) {
+ if (t.kind == 22) {
FormalsOptionalIds(formals);
}
parseVarScope.PopMarker();
@@ -372,22 +375,22 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void FormalsOptionalIds(List<Formal!>! formals) {
Token! id; Type! ty; string! name;
- Expect(21);
+ Expect(22);
if (StartOf(5)) {
TypeIdentOptional(out id, out name, out ty);
formals.Add(new Formal(id, name, ty, true)); parseVarScope.Push(name, name);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
TypeIdentOptional(out id, out name, out ty);
formals.Add(new Formal(id, name, ty, true)); parseVarScope.Push(name, name);
}
}
- Expect(22);
+ Expect(23);
}
static void IdentType(out Token! id, out Type! ty) {
Ident(out id);
- Expect(11);
+ Expect(12);
Type(out ty);
}
@@ -400,7 +403,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Token! id; Type! ty; Type optType = null;
Ident(out id);
- if (t.kind == 11) {
+ if (t.kind == 12) {
Get();
Type(out ty);
optType = ty;
@@ -411,7 +414,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void TypeIdentOptional(out Token! id, out string! identName, out Type! ty) {
string name = null;
TypeAndToken(out id, out ty);
- if (t.kind == 11) {
+ if (t.kind == 12) {
Get();
UserDefinedType udt = ty as UserDefinedType;
if (udt != null && udt.TypeArgs.Count == 0) {
@@ -434,13 +437,13 @@ public static int Parse (List<TopLevelDecl!>! classes) {
tok = Token.NoToken; ty = new BoolType(); /*keep compiler happy*/
List<Type!>! gt;
- if (t.kind == 23) {
+ if (t.kind == 24) {
Get();
tok = token;
- } else if (t.kind == 24) {
+ } else if (t.kind == 25) {
Get();
tok = token; ty = new IntType();
- } else if (t.kind == 25) {
+ } else if (t.kind == 26) {
Get();
tok = token; gt = new List<Type!>();
GenericInstantiation(gt);
@@ -449,7 +452,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
ty = new SetType(gt[0]);
- } else if (t.kind == 26) {
+ } else if (t.kind == 27) {
Get();
tok = token; gt = new List<Type!>();
GenericInstantiation(gt);
@@ -458,58 +461,58 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
ty = new SeqType(gt[0]);
- } else if (t.kind == 1 || t.kind == 27) {
+ } else if (t.kind == 1 || t.kind == 28) {
ReferenceType(out tok, out ty);
- } else Error(96);
+ } else Error(97);
}
static void Formals(bool incoming, List<Formal!>! formals) {
Token! id; Type! ty;
- Expect(21);
+ Expect(22);
if (t.kind == 1) {
IdentType(out id, out ty);
formals.Add(new Formal(id, id.val, ty, incoming)); parseVarScope.Push(id.val, id.val);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
IdentType(out id, out ty);
formals.Add(new Formal(id, id.val, ty, incoming)); parseVarScope.Push(id.val, id.val);
}
}
- Expect(22);
+ Expect(23);
}
static void MethodSpec(List<MaybeFreeExpression!>! req, List<Expression!>! mod, List<MaybeFreeExpression!>! ens) {
Expression! e; bool isFree = false;
- if (t.kind == 17) {
+ if (t.kind == 18) {
Get();
if (StartOf(6)) {
Expression(out e);
mod.Add(e);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
Expression(out e);
mod.Add(e);
}
}
Expect(8);
- } else if (t.kind == 18 || t.kind == 19 || t.kind == 20) {
- if (t.kind == 18) {
+ } else if (t.kind == 19 || t.kind == 20 || t.kind == 21) {
+ if (t.kind == 19) {
Get();
isFree = true;
}
- if (t.kind == 19) {
+ if (t.kind == 20) {
Get();
Expression(out e);
Expect(8);
req.Add(new MaybeFreeExpression(e, isFree));
- } else if (t.kind == 20) {
+ } else if (t.kind == 21) {
Get();
Expression(out e);
Expect(8);
ens.Add(new MaybeFreeExpression(e, isFree));
- } else Error(97);
- } else Error(98);
+ } else Error(98);
+ } else Error(99);
}
static void BlockStmt(out Statement! block) {
@@ -531,7 +534,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void Expression(out Expression! e0) {
Token! x; Expression! e1;
ImpliesExpression(out e0);
- while (t.kind == 52 || t.kind == 53) {
+ while (t.kind == 53 || t.kind == 54) {
EquivOp();
x = token;
ImpliesExpression(out e1);
@@ -541,64 +544,64 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void GenericInstantiation(List<Type!>! gt) {
Type! ty;
- Expect(12);
+ Expect(13);
Type(out ty);
gt.Add(ty);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
Type(out ty);
gt.Add(ty);
}
- Expect(13);
+ Expect(14);
}
static void ReferenceType(out Token! tok, out Type! ty) {
tok = Token.NoToken; ty = new BoolType(); /*keep compiler happy*/
List<Type!>! gt;
- if (t.kind == 27) {
+ if (t.kind == 28) {
Get();
tok = token; ty = new ObjectType();
} else if (t.kind == 1) {
Ident(out tok);
gt = new List<Type!>();
- if (t.kind == 12) {
+ if (t.kind == 13) {
GenericInstantiation(gt);
}
ty = new UserDefinedType(tok, tok.val, gt);
- } else Error(99);
+ } else Error(100);
}
static void FunctionSpec(List<Expression!>! reqs, List<Expression!>! reads, List<Expression!>! decreases) {
Expression! e;
- if (t.kind == 19) {
+ if (t.kind == 20) {
Get();
Expression(out e);
Expect(8);
reqs.Add(e);
- } else if (t.kind == 30) {
+ } else if (t.kind == 31) {
Get();
if (StartOf(8)) {
PossiblyWildExpressions(reads);
}
Expect(8);
- } else if (t.kind == 31) {
+ } else if (t.kind == 32) {
Get();
Expressions(decreases);
Expect(8);
- } else Error(100);
+ } else Error(101);
}
static void FunctionBody(out Expression! e) {
e = dummyExpr;
Expect(5);
- if (t.kind == 33) {
+ if (t.kind == 34) {
IfThenElseExpr(out e);
- } else if (t.kind == 35) {
+ } else if (t.kind == 36) {
MatchExpression(out e);
} else if (StartOf(6)) {
Expression(out e);
- } else Error(101);
+ } else Error(102);
Expect(6);
}
@@ -606,7 +609,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Expression! e;
PossiblyWildExpression(out e);
args.Add(e);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
PossiblyWildExpression(out e);
args.Add(e);
@@ -617,7 +620,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Expression! e;
Expression(out e);
args.Add(e);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
Expression(out e);
args.Add(e);
@@ -626,28 +629,28 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void PossiblyWildExpression(out Expression! e) {
e = dummyExpr;
- if (t.kind == 32) {
+ if (t.kind == 33) {
Get();
e = new WildcardExpr(token);
} else if (StartOf(6)) {
Expression(out e);
- } else Error(102);
+ } else Error(103);
}
static void IfThenElseExpr(out Expression! e) {
Token! x; Expression! e0; Expression! e1 = dummyExpr;
- Expect(33);
+ Expect(34);
x = token;
- Expect(21);
- Expression(out e);
Expect(22);
+ Expression(out e);
+ Expect(23);
ExtendedExpr(out e0);
- Expect(34);
- if (t.kind == 33) {
+ Expect(35);
+ if (t.kind == 34) {
IfThenElseExpr(out e1);
} else if (t.kind == 5) {
ExtendedExpr(out e1);
- } else Error(103);
+ } else Error(104);
e = new ITEExpr(x, e, e0, e1);
}
@@ -655,33 +658,33 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Token! x;
List<MatchCase!> cases = new List<MatchCase!>();
- Expect(35);
+ Expect(36);
x = token;
Expression(out e);
if (t.kind == 5) {
Get();
CaseExpressions(cases);
Expect(6);
- } else if (t.kind == 6 || t.kind == 36) {
+ } else if (t.kind == 6 || t.kind == 37) {
CaseExpressions(cases);
- } else Error(104);
+ } else Error(105);
e = new MatchExpr(x, e, cases);
}
static void ExtendedExpr(out Expression! e) {
e = dummyExpr;
Expect(5);
- if (t.kind == 33) {
+ if (t.kind == 34) {
IfThenElseExpr(out e);
} else if (StartOf(6)) {
Expression(out e);
- } else Error(105);
+ } else Error(106);
Expect(6);
}
static void CaseExpressions(List<MatchCase!>! cases) {
MatchCase! c;
- while (t.kind == 36) {
+ while (t.kind == 37) {
CaseExpression(out c);
cases.Add(c);
}
@@ -692,23 +695,23 @@ public static int Parse (List<TopLevelDecl!>! classes) {
List<BoundVar!> arguments = new List<BoundVar!>();
Expression! body;
- Expect(36);
+ Expect(37);
x = token; parseVarScope.PushMarker();
Ident(out id);
- if (t.kind == 21) {
+ if (t.kind == 22) {
Get();
Ident(out arg);
arguments.Add(new BoundVar(arg, arg.val, new InferredTypeProxy()));
parseVarScope.Push(arg.val, arg.val);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
Ident(out arg);
arguments.Add(new BoundVar(arg, arg.val, new InferredTypeProxy()));
parseVarScope.Push(arg.val, arg.val);
}
- Expect(22);
+ Expect(23);
}
- Expect(37);
+ Expect(38);
Expression(out body);
c = new MatchCase(x, id.val, arguments, body);
parseVarScope.PopMarker();
@@ -723,9 +726,9 @@ public static int Parse (List<TopLevelDecl!>! classes) {
if (StartOf(9)) {
OneStmt(out s);
ss.Add(s);
- } else if (t.kind == 9) {
+ } else if (t.kind == 9 || t.kind == 10) {
VarDeclStmts(ss);
- } else Error(106);
+ } else Error(107);
}
static void OneStmt(out Statement! s) {
@@ -733,51 +736,51 @@ public static int Parse (List<TopLevelDecl!>! classes) {
s = dummyStmt; /* to please the compiler */
switch (t.kind) {
- case 50: {
+ case 51: {
AssertStmt(out s);
break;
}
- case 51: {
+ case 52: {
AssumeStmt(out s);
break;
}
- case 29: {
+ case 30: {
UseStmt(out s);
break;
}
- case 1: case 2: case 5: case 21: case 49: case 70: case 73: case 74: case 75: case 76: case 77: case 78: case 80: case 81: case 84: case 85: {
+ case 1: case 2: case 5: case 22: case 50: case 71: case 74: case 75: case 76: case 77: case 78: case 79: case 81: case 82: case 85: case 86: {
AssignStmt(out s);
break;
}
- case 43: {
+ case 44: {
HavocStmt(out s);
break;
}
- case 46: {
+ case 47: {
CallStmt(out s);
break;
}
- case 33: {
+ case 34: {
IfStmt(out s);
break;
}
- case 44: {
+ case 45: {
WhileStmt(out s);
break;
}
- case 47: {
+ case 48: {
ForeachStmt(out s);
break;
}
- case 38: {
+ case 39: {
Get();
x = token;
Ident(out id);
- Expect(11);
+ Expect(12);
s = new LabelStmt(x, id.val);
break;
}
- case 39: {
+ case 40: {
Get();
x = token;
if (t.kind == 1) {
@@ -788,23 +791,26 @@ public static int Parse (List<TopLevelDecl!>! classes) {
s = new BreakStmt(x, label);
break;
}
- case 40: {
+ case 41: {
Get();
x = token;
Expect(8);
s = new ReturnStmt(x);
break;
}
- default: Error(107); break;
+ default: Error(108); break;
}
}
static void VarDeclStmts(List<Statement!>! ss) {
VarDecl! d;
- Expect(9);
+ if (t.kind == 9) {
+ Get();
+ }
+ Expect(10);
IdentTypeRhs(out d);
ss.Add(d); parseVarScope.Push(d.Name, d.Name);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
IdentTypeRhs(out d);
ss.Add(d); parseVarScope.Push(d.Name, d.Name);
@@ -814,7 +820,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void AssertStmt(out Statement! s) {
Token! x; Expression! e;
- Expect(50);
+ Expect(51);
x = token;
Expression(out e);
Expect(8);
@@ -823,7 +829,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void AssumeStmt(out Statement! s) {
Token! x; Expression! e;
- Expect(51);
+ Expect(52);
x = token;
Expression(out e);
Expect(8);
@@ -832,7 +838,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void UseStmt(out Statement! s) {
Token! x; Expression! e;
- Expect(29);
+ Expect(30);
x = token;
Expression(out e);
Expect(8);
@@ -847,7 +853,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
s = dummyStmt;
LhsExpr(out lhs);
- Expect(41);
+ Expect(42);
x = token;
AssignRhs(out rhs, out ty);
if (rhs != null) {
@@ -862,7 +868,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void HavocStmt(out Statement! s) {
Token! x; Expression! lhs;
- Expect(43);
+ Expect(44);
x = token;
LhsExpr(out lhs);
Expect(8);
@@ -875,11 +881,11 @@ public static int Parse (List<TopLevelDecl!>! classes) {
List<IdentifierExpr!> lhs = new List<IdentifierExpr!>();
List<VarDecl!> newVars = new List<VarDecl!>();
- Expect(46);
+ Expect(47);
x = token;
CallStmtSubExpr(out e);
- if (t.kind == 10 || t.kind == 41) {
- if (t.kind == 10) {
+ if (t.kind == 11 || t.kind == 42) {
+ if (t.kind == 11) {
Get();
e = ConvertToLocal(e);
if (e is IdentifierExpr) {
@@ -892,12 +898,12 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Ident(out id);
RecordCallLhs(new IdentifierExpr(id, id.val), lhs, newVars);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
Ident(out id);
RecordCallLhs(new IdentifierExpr(id, id.val), lhs, newVars);
}
- Expect(41);
+ Expect(42);
CallStmtSubExpr(out e);
} else {
Get();
@@ -931,19 +937,19 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Statement! s;
Statement els = null;
- Expect(33);
+ Expect(34);
x = token;
Guard(out guard);
BlockStmt(out thn);
- if (t.kind == 34) {
+ if (t.kind == 35) {
Get();
- if (t.kind == 33) {
+ if (t.kind == 34) {
IfStmt(out s);
els = s;
} else if (t.kind == 5) {
BlockStmt(out s);
els = s;
- } else Error(108);
+ } else Error(109);
}
ifStmt = new IfStmt(x, guard, thn, els);
}
@@ -956,18 +962,18 @@ public static int Parse (List<TopLevelDecl!>! classes) {
List<Expression!> decreases = new List<Expression!>();
Statement! body;
- Expect(44);
+ Expect(45);
x = token;
Guard(out guard);
assume guard == null || Owner.None(guard);
- while (t.kind == 18 || t.kind == 31 || t.kind == 45) {
- if (t.kind == 18 || t.kind == 45) {
+ while (t.kind == 19 || t.kind == 32 || t.kind == 46) {
+ if (t.kind == 19 || t.kind == 46) {
isFree = false;
- if (t.kind == 18) {
+ if (t.kind == 19) {
Get();
isFree = true;
}
- Expect(45);
+ Expect(46);
Expression(out e);
invariants.Add(new MaybeFreeExpression(e, isFree));
Expect(8);
@@ -990,31 +996,31 @@ public static int Parse (List<TopLevelDecl!>! classes) {
AssignStmt bodyAssign = null;
parseVarScope.PushMarker();
- Expect(47);
+ Expect(48);
x = token;
range = new LiteralExpr(x, true);
ty = new InferredTypeProxy();
- Expect(21);
+ Expect(22);
Ident(out boundVar);
- if (t.kind == 11) {
+ if (t.kind == 12) {
Get();
Type(out ty);
}
- Expect(48);
+ Expect(49);
Expression(out collection);
parseVarScope.Push(boundVar.val, boundVar.val);
- if (t.kind == 49) {
+ if (t.kind == 50) {
Get();
Expression(out range);
}
- Expect(22);
+ Expect(23);
Expect(5);
- while (t.kind == 29 || t.kind == 50 || t.kind == 51) {
- if (t.kind == 50) {
+ while (t.kind == 30 || t.kind == 51 || t.kind == 52) {
+ if (t.kind == 51) {
AssertStmt(out s);
if (s is PredicateStmt) { bodyPrefix.Add((PredicateStmt)s); }
- } else if (t.kind == 51) {
+ } else if (t.kind == 52) {
AssumeStmt(out s);
if (s is PredicateStmt) { bodyPrefix.Add((PredicateStmt)s); }
} else {
@@ -1025,10 +1031,10 @@ public static int Parse (List<TopLevelDecl!>! classes) {
if (StartOf(6)) {
AssignStmt(out s);
if (s is AssignStmt) { bodyAssign = (AssignStmt)s; }
- } else if (t.kind == 43) {
+ } else if (t.kind == 44) {
HavocStmt(out s);
if (s is AssignStmt) { bodyAssign = (AssignStmt)s; }
- } else Error(109);
+ } else Error(110);
Expect(6);
s = new ForeachStmt(x, new BoundVar(boundVar, boundVar.val, ty), collection, range, bodyPrefix, bodyAssign);
parseVarScope.PopMarker();
@@ -1042,14 +1048,14 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Token! x; Expression! ee; Type! tt;
e = null; ty = null;
- if (t.kind == 42) {
+ if (t.kind == 43) {
Get();
ReferenceType(out x, out tt);
ty = tt;
} else if (StartOf(6)) {
Expression(out ee);
e = ee;
- } else Error(110);
+ } else Error(111);
if (e == null && ty == null) { e = dummyExpr; }
}
@@ -1059,12 +1065,12 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Type optionalType = null; DeterminedAssignmentRhs optionalRhs = null;
Ident(out id);
- if (t.kind == 11) {
+ if (t.kind == 12) {
Get();
Type(out ty);
optionalType = ty;
}
- if (t.kind == 41) {
+ if (t.kind == 42) {
Get();
AssignRhs(out rhs, out newType);
}
@@ -1082,26 +1088,26 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void Guard(out Expression e) {
Expression! ee; e = null;
- Expect(21);
- if (t.kind == 32) {
+ Expect(22);
+ if (t.kind == 33) {
Get();
e = null;
} else if (StartOf(6)) {
Expression(out ee);
e = ee;
- } else Error(111);
- Expect(22);
+ } else Error(112);
+ Expect(23);
}
static void CallStmtSubExpr(out Expression! e) {
e = dummyExpr;
if (t.kind == 1) {
IdentOrFuncExpression(out e);
- } else if (t.kind == 21 || t.kind == 84 || t.kind == 85) {
+ } else if (t.kind == 22 || t.kind == 85 || t.kind == 86) {
ObjectExpression(out e);
SelectOrCallSuffix(ref e);
- } else Error(112);
- while (t.kind == 79 || t.kind == 81) {
+ } else Error(113);
+ while (t.kind == 80 || t.kind == 82) {
SelectOrCallSuffix(ref e);
}
}
@@ -1109,7 +1115,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void ImpliesExpression(out Expression! e0) {
Token! x; Expression! e1;
LogicalExpression(out e0);
- if (t.kind == 54 || t.kind == 55) {
+ if (t.kind == 55 || t.kind == 56) {
ImpliesOp();
x = token;
ImpliesExpression(out e1);
@@ -1118,23 +1124,23 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
static void EquivOp() {
- if (t.kind == 52) {
+ if (t.kind == 53) {
Get();
- } else if (t.kind == 53) {
+ } else if (t.kind == 54) {
Get();
- } else Error(113);
+ } else Error(114);
}
static void LogicalExpression(out Expression! e0) {
Token! x; Expression! e1;
RelationalExpression(out e0);
if (StartOf(10)) {
- if (t.kind == 56 || t.kind == 57) {
+ if (t.kind == 57 || t.kind == 58) {
AndOp();
x = token;
RelationalExpression(out e1);
e0 = new BinaryExpr(x, BinaryExpr.Opcode.And, e0, e1);
- while (t.kind == 56 || t.kind == 57) {
+ while (t.kind == 57 || t.kind == 58) {
AndOp();
x = token;
RelationalExpression(out e1);
@@ -1145,7 +1151,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
x = token;
RelationalExpression(out e1);
e0 = new BinaryExpr(x, BinaryExpr.Opcode.Or, e0, e1);
- while (t.kind == 58 || t.kind == 59) {
+ while (t.kind == 59 || t.kind == 60) {
OrOp();
x = token;
RelationalExpression(out e1);
@@ -1156,11 +1162,11 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
static void ImpliesOp() {
- if (t.kind == 54) {
+ if (t.kind == 55) {
Get();
- } else if (t.kind == 55) {
+ } else if (t.kind == 56) {
Get();
- } else Error(114);
+ } else Error(115);
}
static void RelationalExpression(out Expression! e0) {
@@ -1174,25 +1180,25 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
static void AndOp() {
- if (t.kind == 56) {
+ if (t.kind == 57) {
Get();
- } else if (t.kind == 57) {
+ } else if (t.kind == 58) {
Get();
- } else Error(115);
+ } else Error(116);
}
static void OrOp() {
- if (t.kind == 58) {
+ if (t.kind == 59) {
Get();
- } else if (t.kind == 59) {
+ } else if (t.kind == 60) {
Get();
- } else Error(116);
+ } else Error(117);
}
static void Term(out Expression! e0) {
Token! x; Expression! e1; BinaryExpr.Opcode op;
Factor(out e0);
- while (t.kind == 69 || t.kind == 70) {
+ while (t.kind == 70 || t.kind == 71) {
AddOp(out x, out op);
Factor(out e1);
e0 = new BinaryExpr(x, op, e0, e1);
@@ -1202,74 +1208,74 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void RelOp(out Token! x, out BinaryExpr.Opcode op) {
x = Token.NoToken; op = BinaryExpr.Opcode.Add/*(dummy)*/;
switch (t.kind) {
- case 60: {
+ case 61: {
Get();
x = token; op = BinaryExpr.Opcode.Eq;
break;
}
- case 12: {
+ case 13: {
Get();
x = token; op = BinaryExpr.Opcode.Lt;
break;
}
- case 13: {
+ case 14: {
Get();
x = token; op = BinaryExpr.Opcode.Gt;
break;
}
- case 61: {
+ case 62: {
Get();
x = token; op = BinaryExpr.Opcode.Le;
break;
}
- case 62: {
+ case 63: {
Get();
x = token; op = BinaryExpr.Opcode.Ge;
break;
}
- case 63: {
+ case 64: {
Get();
x = token; op = BinaryExpr.Opcode.Neq;
break;
}
- case 64: {
+ case 65: {
Get();
x = token; op = BinaryExpr.Opcode.Disjoint;
break;
}
- case 48: {
+ case 49: {
Get();
x = token; op = BinaryExpr.Opcode.In;
break;
}
- case 65: {
+ case 66: {
Get();
x = token; op = BinaryExpr.Opcode.NotIn;
break;
}
- case 66: {
+ case 67: {
Get();
x = token; op = BinaryExpr.Opcode.Neq;
break;
}
- case 67: {
+ case 68: {
Get();
x = token; op = BinaryExpr.Opcode.Le;
break;
}
- case 68: {
+ case 69: {
Get();
x = token; op = BinaryExpr.Opcode.Ge;
break;
}
- default: Error(117); break;
+ default: Error(118); break;
}
}
static void Factor(out Expression! e0) {
Token! x; Expression! e1; BinaryExpr.Opcode op;
UnaryExpression(out e0);
- while (t.kind == 32 || t.kind == 71 || t.kind == 72) {
+ while (t.kind == 33 || t.kind == 72 || t.kind == 73) {
MulOp(out x, out op);
UnaryExpression(out e1);
e0 = new BinaryExpr(x, op, e0, e1);
@@ -1278,23 +1284,23 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void AddOp(out Token! x, out BinaryExpr.Opcode op) {
x = Token.NoToken; op=BinaryExpr.Opcode.Add/*(dummy)*/;
- if (t.kind == 69) {
+ if (t.kind == 70) {
Get();
x = token; op = BinaryExpr.Opcode.Add;
- } else if (t.kind == 70) {
+ } else if (t.kind == 71) {
Get();
x = token; op = BinaryExpr.Opcode.Sub;
- } else Error(118);
+ } else Error(119);
}
static void UnaryExpression(out Expression! e) {
Token! x; e = dummyExpr;
- if (t.kind == 70) {
+ if (t.kind == 71) {
Get();
x = token;
UnaryExpression(out e);
e = new BinaryExpr(x, BinaryExpr.Opcode.Sub, new LiteralExpr(x, 0), e);
- } else if (t.kind == 73 || t.kind == 74) {
+ } else if (t.kind == 74 || t.kind == 75) {
NegOp();
x = token;
UnaryExpression(out e);
@@ -1303,39 +1309,39 @@ public static int Parse (List<TopLevelDecl!>! classes) {
SelectExpression(out e);
} else if (StartOf(13)) {
ConstAtomExpression(out e);
- } else Error(119);
+ } else Error(120);
}
static void MulOp(out Token! x, out BinaryExpr.Opcode op) {
x = Token.NoToken; op = BinaryExpr.Opcode.Add/*(dummy)*/;
- if (t.kind == 32) {
+ if (t.kind == 33) {
Get();
x = token; op = BinaryExpr.Opcode.Mul;
- } else if (t.kind == 71) {
+ } else if (t.kind == 72) {
Get();
x = token; op = BinaryExpr.Opcode.Div;
- } else if (t.kind == 72) {
+ } else if (t.kind == 73) {
Get();
x = token; op = BinaryExpr.Opcode.Mod;
- } else Error(120);
+ } else Error(121);
}
static void NegOp() {
- if (t.kind == 73) {
+ if (t.kind == 74) {
Get();
- } else if (t.kind == 74) {
+ } else if (t.kind == 75) {
Get();
- } else Error(121);
+ } else Error(122);
}
static void SelectExpression(out Expression! e) {
Token! id; e = dummyExpr;
if (t.kind == 1) {
IdentOrFuncExpression(out e);
- } else if (t.kind == 21 || t.kind == 84 || t.kind == 85) {
+ } else if (t.kind == 22 || t.kind == 85 || t.kind == 86) {
ObjectExpression(out e);
- } else Error(122);
- while (t.kind == 79 || t.kind == 81) {
+ } else Error(123);
+ while (t.kind == 80 || t.kind == 82) {
SelectOrCallSuffix(ref e);
}
}
@@ -1345,17 +1351,17 @@ public static int Parse (List<TopLevelDecl!>! classes) {
e = dummyExpr;
switch (t.kind) {
- case 75: {
+ case 76: {
Get();
e = new LiteralExpr(token, false);
break;
}
- case 76: {
+ case 77: {
Get();
e = new LiteralExpr(token, true);
break;
}
- case 77: {
+ case 78: {
Get();
e = new LiteralExpr(token);
break;
@@ -1365,38 +1371,38 @@ public static int Parse (List<TopLevelDecl!>! classes) {
e = new LiteralExpr(token, n);
break;
}
- case 78: {
+ case 79: {
Get();
x = token;
Ident(out dtName);
- Expect(79);
+ Expect(80);
Ident(out id);
elements = new List<Expression!>();
- if (t.kind == 21) {
+ if (t.kind == 22) {
Get();
if (StartOf(6)) {
Expressions(elements);
}
- Expect(22);
+ Expect(23);
}
e = new DatatypeValue(token, dtName.val, id.val, elements);
break;
}
- case 80: {
+ case 81: {
Get();
x = token;
- Expect(21);
- Expression(out e);
Expect(22);
+ Expression(out e);
+ Expect(23);
e = new FreshExpr(x, e);
break;
}
- case 49: {
+ case 50: {
Get();
x = token;
Expression(out e);
e = new UnaryExpr(x, UnaryExpr.Opcode.SeqLength, e);
- Expect(49);
+ Expect(50);
break;
}
case 5: {
@@ -1409,17 +1415,17 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Expect(6);
break;
}
- case 81: {
+ case 82: {
Get();
x = token; elements = new List<Expression!>();
if (StartOf(6)) {
Expressions(elements);
}
e = new SeqDisplayExpr(x, elements);
- Expect(82);
+ Expect(83);
break;
}
- default: Error(123); break;
+ default: Error(124); break;
}
}
@@ -1437,13 +1443,13 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void IdentOrFuncExpression(out Expression! e) {
Token! id; e = dummyExpr; List<Expression!>! args;
Ident(out id);
- if (t.kind == 21) {
+ if (t.kind == 22) {
Get();
args = new List<Expression!>();
if (StartOf(6)) {
Expressions(args);
}
- Expect(22);
+ Expect(23);
e = new FunctionCallExpr(id, id.val, new ImplicitThisExpr(id), args);
}
if (e == dummyExpr) {
@@ -1458,25 +1464,25 @@ public static int Parse (List<TopLevelDecl!>! classes) {
static void ObjectExpression(out Expression! e) {
Token! x; e = dummyExpr;
- if (t.kind == 84) {
+ if (t.kind == 85) {
Get();
e = new ThisExpr(token);
- } else if (t.kind == 85) {
+ } else if (t.kind == 86) {
Get();
x = token;
- Expect(21);
- Expression(out e);
Expect(22);
+ Expression(out e);
+ Expect(23);
e = new OldExpr(x, e);
- } else if (t.kind == 21) {
+ } else if (t.kind == 22) {
Get();
if (StartOf(14)) {
QuantifierGuts(out e);
} else if (StartOf(6)) {
Expression(out e);
- } else Error(124);
- Expect(22);
- } else Error(125);
+ } else Error(125);
+ Expect(23);
+ } else Error(126);
}
static void SelectOrCallSuffix(ref Expression! e) {
@@ -1484,27 +1490,27 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Expression e0 = null; Expression e1 = null; Expression! ee; bool anyDots = false;
bool func = false;
- if (t.kind == 79) {
+ if (t.kind == 80) {
Get();
Ident(out id);
- if (t.kind == 21) {
+ if (t.kind == 22) {
Get();
args = new List<Expression!>(); func = true;
if (StartOf(6)) {
Expressions(args);
}
- Expect(22);
+ Expect(23);
e = new FunctionCallExpr(id, id.val, e, args);
}
if (!func) { e = new FieldSelectExpr(id, e, id.val); }
- } else if (t.kind == 81) {
+ } else if (t.kind == 82) {
Get();
x = token;
if (StartOf(6)) {
Expression(out ee);
e0 = ee;
- if (t.kind == 41 || t.kind == 83) {
- if (t.kind == 83) {
+ if (t.kind == 42 || t.kind == 84) {
+ if (t.kind == 84) {
Get();
anyDots = true;
if (StartOf(6)) {
@@ -1517,11 +1523,11 @@ public static int Parse (List<TopLevelDecl!>! classes) {
e1 = ee;
}
}
- } else if (t.kind == 83) {
+ } else if (t.kind == 84) {
Get();
Expression(out ee);
anyDots = true; e1 = ee;
- } else Error(126);
+ } else Error(127);
assert !anyDots ==> e0 != null;
if (anyDots) {
assert e0 != null || e1 != null;
@@ -1534,8 +1540,8 @@ public static int Parse (List<TopLevelDecl!>! classes) {
e = new SeqUpdateExpr(x, e, e0, e1);
}
- Expect(82);
- } else Error(127);
+ Expect(83);
+ } else Error(128);
}
static void QuantifierGuts(out Expression! q) {
@@ -1548,17 +1554,17 @@ public static int Parse (List<TopLevelDecl!>! classes) {
Triggers trigs = null;
Expression! body;
- if (t.kind == 86 || t.kind == 87) {
+ if (t.kind == 87 || t.kind == 88) {
Forall();
x = token; univ = true;
- } else if (t.kind == 88 || t.kind == 89) {
+ } else if (t.kind == 89 || t.kind == 90) {
Exists();
x = token;
- } else Error(128);
+ } else Error(129);
parseVarScope.PushMarker();
IdentTypeOptional(out bv);
bvars.Add(bv); parseVarScope.Push(bv.Name, bv.Name);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
IdentTypeOptional(out bv);
bvars.Add(bv); parseVarScope.Push(bv.Name, bv.Name);
@@ -1578,40 +1584,40 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
static void Forall() {
- if (t.kind == 86) {
+ if (t.kind == 87) {
Get();
- } else if (t.kind == 87) {
+ } else if (t.kind == 88) {
Get();
- } else Error(129);
+ } else Error(130);
}
static void Exists() {
- if (t.kind == 88) {
+ if (t.kind == 89) {
Get();
- } else if (t.kind == 89) {
+ } else if (t.kind == 90) {
Get();
- } else Error(130);
+ } else Error(131);
}
static void QSep() {
- if (t.kind == 90) {
+ if (t.kind == 91) {
Get();
- } else if (t.kind == 91) {
+ } else if (t.kind == 92) {
Get();
- } else Error(131);
+ } else Error(132);
}
static void AttributeOrTrigger(ref Attributes attrs, ref Triggers trigs) {
List<Expression!> es = new List<Expression!>();
Expect(5);
- if (t.kind == 11) {
+ if (t.kind == 12) {
AttributeBody(ref attrs);
} else if (StartOf(6)) {
es = new List<Expression!>();
Expressions(es);
trigs = new Triggers(es, trigs);
- } else Error(132);
+ } else Error(133);
Expect(6);
}
@@ -1620,13 +1626,13 @@ public static int Parse (List<TopLevelDecl!>! classes) {
List<Attributes.Argument!> aArgs = new List<Attributes.Argument!>();
Attributes.Argument! aArg;
- Expect(11);
+ Expect(12);
Expect(1);
aName = token.val;
if (StartOf(15)) {
AttributeArg(out aArg);
aArgs.Add(aArg);
- while (t.kind == 10) {
+ while (t.kind == 11) {
Get();
AttributeArg(out aArg);
aArgs.Add(aArg);
@@ -1643,7 +1649,7 @@ public static int Parse (List<TopLevelDecl!>! classes) {
} else if (StartOf(6)) {
Expression(out e);
arg = new Attributes.Argument(e);
- } else Error(133);
+ } else Error(134);
}
@@ -1671,131 +1677,132 @@ public static int Parse (List<TopLevelDecl!>! classes) {
case 6: s = "} expected"; break;
case 7: s = "datatype expected"; break;
case 8: s = "; expected"; break;
- case 9: s = "var expected"; break;
- case 10: s = ", expected"; break;
- case 11: s = ": expected"; break;
- case 12: s = "< expected"; break;
- case 13: s = "> expected"; break;
- case 14: s = "frame expected"; break;
- case 15: s = "method expected"; break;
- case 16: s = "returns expected"; break;
- case 17: s = "modifies expected"; break;
- case 18: s = "free expected"; break;
- case 19: s = "requires expected"; break;
- case 20: s = "ensures expected"; break;
- case 21: s = "( expected"; break;
- case 22: s = ") expected"; break;
- case 23: s = "bool expected"; break;
- case 24: s = "int expected"; break;
- case 25: s = "set expected"; break;
- case 26: s = "seq expected"; break;
- case 27: s = "object expected"; break;
- case 28: s = "function expected"; break;
- case 29: s = "use expected"; break;
- case 30: s = "reads expected"; break;
- case 31: s = "decreases expected"; break;
- case 32: s = "* expected"; break;
- case 33: s = "if expected"; break;
- case 34: s = "else expected"; break;
- case 35: s = "match expected"; break;
- case 36: s = "case expected"; break;
- case 37: s = "=> expected"; break;
- case 38: s = "label expected"; break;
- case 39: s = "break expected"; break;
- case 40: s = "return expected"; break;
- case 41: s = ":= expected"; break;
- case 42: s = "new expected"; break;
- case 43: s = "havoc expected"; break;
- case 44: s = "while expected"; break;
- case 45: s = "invariant expected"; break;
- case 46: s = "call expected"; break;
- case 47: s = "foreach expected"; break;
- case 48: s = "in expected"; break;
- case 49: s = "| expected"; break;
- case 50: s = "assert expected"; break;
- case 51: s = "assume expected"; break;
- case 52: s = "<==> expected"; break;
- case 53: s = "\\u21d4 expected"; break;
- case 54: s = "==> expected"; break;
- case 55: s = "\\u21d2 expected"; break;
- case 56: s = "&& expected"; break;
- case 57: s = "\\u2227 expected"; break;
- case 58: s = "|| expected"; break;
- case 59: s = "\\u2228 expected"; break;
- case 60: s = "== expected"; break;
- case 61: s = "<= expected"; break;
- case 62: s = ">= expected"; break;
- case 63: s = "!= expected"; break;
- case 64: s = "!! expected"; break;
- case 65: s = "!in expected"; break;
- case 66: s = "\\u2260 expected"; break;
- case 67: s = "\\u2264 expected"; break;
- case 68: s = "\\u2265 expected"; break;
- case 69: s = "+ expected"; break;
- case 70: s = "- expected"; break;
- case 71: s = "/ expected"; break;
- case 72: s = "% expected"; break;
- case 73: s = "! expected"; break;
- case 74: s = "\\u00ac expected"; break;
- case 75: s = "false expected"; break;
- case 76: s = "true expected"; break;
- case 77: s = "null expected"; break;
- case 78: s = "# expected"; break;
- case 79: s = ". expected"; break;
- case 80: s = "fresh expected"; break;
- case 81: s = "[ expected"; break;
- case 82: s = "] expected"; break;
- case 83: s = ".. expected"; break;
- case 84: s = "this expected"; break;
- case 85: s = "old expected"; break;
- case 86: s = "forall expected"; break;
- case 87: s = "\\u2200 expected"; break;
- case 88: s = "exists expected"; break;
- case 89: s = "\\u2203 expected"; break;
- case 90: s = ":: expected"; break;
- case 91: s = "\\u2022 expected"; break;
- case 92: s = "??? expected"; break;
- case 93: s = "invalid ClassMemberDecl"; break;
- case 94: s = "invalid FunctionDecl"; break;
- case 95: s = "invalid MethodDecl"; break;
- case 96: s = "invalid TypeAndToken"; break;
- case 97: s = "invalid MethodSpec"; break;
+ case 9: s = "ghost expected"; break;
+ case 10: s = "var expected"; break;
+ case 11: s = ", expected"; break;
+ case 12: s = ": expected"; break;
+ case 13: s = "< expected"; break;
+ case 14: s = "> expected"; break;
+ case 15: s = "frame expected"; break;
+ case 16: s = "method expected"; break;
+ case 17: s = "returns expected"; break;
+ case 18: s = "modifies expected"; break;
+ case 19: s = "free expected"; break;
+ case 20: s = "requires expected"; break;
+ case 21: s = "ensures expected"; break;
+ case 22: s = "( expected"; break;
+ case 23: s = ") expected"; break;
+ case 24: s = "bool expected"; break;
+ case 25: s = "int expected"; break;
+ case 26: s = "set expected"; break;
+ case 27: s = "seq expected"; break;
+ case 28: s = "object expected"; break;
+ case 29: s = "function expected"; break;
+ case 30: s = "use expected"; break;
+ case 31: s = "reads expected"; break;
+ case 32: s = "decreases expected"; break;
+ case 33: s = "* expected"; break;
+ case 34: s = "if expected"; break;
+ case 35: s = "else expected"; break;
+ case 36: s = "match expected"; break;
+ case 37: s = "case expected"; break;
+ case 38: s = "=> expected"; break;
+ case 39: s = "label expected"; break;
+ case 40: s = "break expected"; break;
+ case 41: s = "return expected"; break;
+ case 42: s = ":= expected"; break;
+ case 43: s = "new expected"; break;
+ case 44: s = "havoc expected"; break;
+ case 45: s = "while expected"; break;
+ case 46: s = "invariant expected"; break;
+ case 47: s = "call expected"; break;
+ case 48: s = "foreach expected"; break;
+ case 49: s = "in expected"; break;
+ case 50: s = "| expected"; break;
+ case 51: s = "assert expected"; break;
+ case 52: s = "assume expected"; break;
+ case 53: s = "<==> expected"; break;
+ case 54: s = "\\u21d4 expected"; break;
+ case 55: s = "==> expected"; break;
+ case 56: s = "\\u21d2 expected"; break;
+ case 57: s = "&& expected"; break;
+ case 58: s = "\\u2227 expected"; break;
+ case 59: s = "|| expected"; break;
+ case 60: s = "\\u2228 expected"; break;
+ case 61: s = "== expected"; break;
+ case 62: s = "<= expected"; break;
+ case 63: s = ">= expected"; break;
+ case 64: s = "!= expected"; break;
+ case 65: s = "!! expected"; break;
+ case 66: s = "!in expected"; break;
+ case 67: s = "\\u2260 expected"; break;
+ case 68: s = "\\u2264 expected"; break;
+ case 69: s = "\\u2265 expected"; break;
+ case 70: s = "+ expected"; break;
+ case 71: s = "- expected"; break;
+ case 72: s = "/ expected"; break;
+ case 73: s = "% expected"; break;
+ case 74: s = "! expected"; break;
+ case 75: s = "\\u00ac expected"; break;
+ case 76: s = "false expected"; break;
+ case 77: s = "true expected"; break;
+ case 78: s = "null expected"; break;
+ case 79: s = "# expected"; break;
+ case 80: s = ". expected"; break;
+ case 81: s = "fresh expected"; break;
+ case 82: s = "[ expected"; break;
+ case 83: s = "] expected"; break;
+ case 84: s = ".. expected"; break;
+ case 85: s = "this expected"; break;
+ case 86: s = "old expected"; break;
+ case 87: s = "forall expected"; break;
+ case 88: s = "\\u2200 expected"; break;
+ case 89: s = "exists expected"; break;
+ case 90: s = "\\u2203 expected"; break;
+ case 91: s = ":: expected"; break;
+ case 92: s = "\\u2022 expected"; break;
+ case 93: s = "??? expected"; break;
+ case 94: s = "invalid ClassMemberDecl"; break;
+ case 95: s = "invalid FunctionDecl"; break;
+ case 96: s = "invalid MethodDecl"; break;
+ case 97: s = "invalid TypeAndToken"; break;
case 98: s = "invalid MethodSpec"; break;
- case 99: s = "invalid ReferenceType"; break;
- case 100: s = "invalid FunctionSpec"; break;
- case 101: s = "invalid FunctionBody"; break;
- case 102: s = "invalid PossiblyWildExpression"; break;
- case 103: s = "invalid IfThenElseExpr"; break;
- case 104: s = "invalid MatchExpression"; break;
- case 105: s = "invalid ExtendedExpr"; break;
- case 106: s = "invalid Stmt"; break;
- case 107: s = "invalid OneStmt"; break;
- case 108: s = "invalid IfStmt"; break;
- case 109: s = "invalid ForeachStmt"; break;
- case 110: s = "invalid AssignRhs"; break;
- case 111: s = "invalid Guard"; break;
- case 112: s = "invalid CallStmtSubExpr"; break;
- case 113: s = "invalid EquivOp"; break;
- case 114: s = "invalid ImpliesOp"; break;
- case 115: s = "invalid AndOp"; break;
- case 116: s = "invalid OrOp"; break;
- case 117: s = "invalid RelOp"; break;
- case 118: s = "invalid AddOp"; break;
- case 119: s = "invalid UnaryExpression"; break;
- case 120: s = "invalid MulOp"; break;
- case 121: s = "invalid NegOp"; break;
- case 122: s = "invalid SelectExpression"; break;
- case 123: s = "invalid ConstAtomExpression"; break;
- case 124: s = "invalid ObjectExpression"; break;
+ case 99: s = "invalid MethodSpec"; break;
+ case 100: s = "invalid ReferenceType"; break;
+ case 101: s = "invalid FunctionSpec"; break;
+ case 102: s = "invalid FunctionBody"; break;
+ case 103: s = "invalid PossiblyWildExpression"; break;
+ case 104: s = "invalid IfThenElseExpr"; break;
+ case 105: s = "invalid MatchExpression"; break;
+ case 106: s = "invalid ExtendedExpr"; break;
+ case 107: s = "invalid Stmt"; break;
+ case 108: s = "invalid OneStmt"; break;
+ case 109: s = "invalid IfStmt"; break;
+ case 110: s = "invalid ForeachStmt"; break;
+ case 111: s = "invalid AssignRhs"; break;
+ case 112: s = "invalid Guard"; break;
+ case 113: s = "invalid CallStmtSubExpr"; break;
+ case 114: s = "invalid EquivOp"; break;
+ case 115: s = "invalid ImpliesOp"; break;
+ case 116: s = "invalid AndOp"; break;
+ case 117: s = "invalid OrOp"; break;
+ case 118: s = "invalid RelOp"; break;
+ case 119: s = "invalid AddOp"; break;
+ case 120: s = "invalid UnaryExpression"; break;
+ case 121: s = "invalid MulOp"; break;
+ case 122: s = "invalid NegOp"; break;
+ case 123: s = "invalid SelectExpression"; break;
+ case 124: s = "invalid ConstAtomExpression"; break;
case 125: s = "invalid ObjectExpression"; break;
- case 126: s = "invalid SelectOrCallSuffix"; break;
+ case 126: s = "invalid ObjectExpression"; break;
case 127: s = "invalid SelectOrCallSuffix"; break;
- case 128: s = "invalid QuantifierGuts"; break;
- case 129: s = "invalid Forall"; break;
- case 130: s = "invalid Exists"; break;
- case 131: s = "invalid QSep"; break;
- case 132: s = "invalid AttributeOrTrigger"; break;
- case 133: s = "invalid AttributeArg"; break;
+ case 128: s = "invalid SelectOrCallSuffix"; break;
+ case 129: s = "invalid QuantifierGuts"; break;
+ case 130: s = "invalid Forall"; break;
+ case 131: s = "invalid Exists"; break;
+ case 132: s = "invalid QSep"; break;
+ case 133: s = "invalid AttributeOrTrigger"; break;
+ case 134: s = "invalid AttributeArg"; break;
default: s = "error " + n; break;
}
@@ -1803,22 +1810,22 @@ public static int Parse (List<TopLevelDecl!>! classes) {
}
static bool[,]! set = {
- {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, T,T,x,x, T,T,x,x, x,x,x,x, x,x},
- {x,T,T,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,T,x,x, x,T,x,x, x,x,T,T, T,x,x,T, T,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, T,T,x,x, T,T,x,x, x,x,x,x, x,x},
- {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, T,T,x,x, T,T,x,x, x,x,x,x, x,x},
- {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,T,x,x, x,T,x,x, x,x,T,T, T,x,x,T, T,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, T,T,x,x, T,T,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x},
- {x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x},
- {x,T,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,T,T,T, T,T,T,x, T,T,x,x, T,T,x,x, x,x,x,x, x,x}
+ {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x},
+ {x,T,T,x, x,T,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,T, T,T,x,x, T,T,x,T, T,x,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x},
+ {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x},
+ {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,T, T,T,x,x, T,T,x,T, T,x,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x},
+ {x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,x,x},
+ {x,T,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x}
};
diff --git a/Dafny/Scanner.ssc b/Dafny/Scanner.ssc
index 2d38d972..c134acf9 100644
--- a/Dafny/Scanner.ssc
+++ b/Dafny/Scanner.ssc
@@ -133,7 +133,7 @@ public class Scanner {
start[8804] = 38;
start[8805] = 39;
}
- const int noSym = 92;
+ const int noSym = 93;
static short[] start = new short[16385];
@@ -277,47 +277,48 @@ public class Scanner {
switch (t.val) {
case "class": t.kind = 4; break;
case "datatype": t.kind = 7; break;
- case "var": t.kind = 9; break;
- case "frame": t.kind = 14; break;
- case "method": t.kind = 15; break;
- case "returns": t.kind = 16; break;
- case "modifies": t.kind = 17; break;
- case "free": t.kind = 18; break;
- case "requires": t.kind = 19; break;
- case "ensures": t.kind = 20; break;
- case "bool": t.kind = 23; break;
- case "int": t.kind = 24; break;
- case "set": t.kind = 25; break;
- case "seq": t.kind = 26; break;
- case "object": t.kind = 27; break;
- case "function": t.kind = 28; break;
- case "use": t.kind = 29; break;
- case "reads": t.kind = 30; break;
- case "decreases": t.kind = 31; break;
- case "if": t.kind = 33; break;
- case "else": t.kind = 34; break;
- case "match": t.kind = 35; break;
- case "case": t.kind = 36; break;
- case "label": t.kind = 38; break;
- case "break": t.kind = 39; break;
- case "return": t.kind = 40; break;
- case "new": t.kind = 42; break;
- case "havoc": t.kind = 43; break;
- case "while": t.kind = 44; break;
- case "invariant": t.kind = 45; break;
- case "call": t.kind = 46; break;
- case "foreach": t.kind = 47; break;
- case "in": t.kind = 48; break;
- case "assert": t.kind = 50; break;
- case "assume": t.kind = 51; break;
- case "false": t.kind = 75; break;
- case "true": t.kind = 76; break;
- case "null": t.kind = 77; break;
- case "fresh": t.kind = 80; break;
- case "this": t.kind = 84; break;
- case "old": t.kind = 85; break;
- case "forall": t.kind = 86; break;
- case "exists": t.kind = 88; break;
+ case "ghost": t.kind = 9; break;
+ case "var": t.kind = 10; break;
+ case "frame": t.kind = 15; break;
+ case "method": t.kind = 16; break;
+ case "returns": t.kind = 17; break;
+ case "modifies": t.kind = 18; break;
+ case "free": t.kind = 19; break;
+ case "requires": t.kind = 20; break;
+ case "ensures": t.kind = 21; break;
+ case "bool": t.kind = 24; break;
+ case "int": t.kind = 25; break;
+ case "set": t.kind = 26; break;
+ case "seq": t.kind = 27; break;
+ case "object": t.kind = 28; break;
+ case "function": t.kind = 29; break;
+ case "use": t.kind = 30; break;
+ case "reads": t.kind = 31; break;
+ case "decreases": t.kind = 32; break;
+ case "if": t.kind = 34; break;
+ case "else": t.kind = 35; break;
+ case "match": t.kind = 36; break;
+ case "case": t.kind = 37; break;
+ case "label": t.kind = 39; break;
+ case "break": t.kind = 40; break;
+ case "return": t.kind = 41; break;
+ case "new": t.kind = 43; break;
+ case "havoc": t.kind = 44; break;
+ case "while": t.kind = 45; break;
+ case "invariant": t.kind = 46; break;
+ case "call": t.kind = 47; break;
+ case "foreach": t.kind = 48; break;
+ case "in": t.kind = 49; break;
+ case "assert": t.kind = 51; break;
+ case "assume": t.kind = 52; break;
+ case "false": t.kind = 76; break;
+ case "true": t.kind = 77; break;
+ case "null": t.kind = 78; break;
+ case "fresh": t.kind = 81; break;
+ case "this": t.kind = 85; break;
+ case "old": t.kind = 86; break;
+ case "forall": t.kind = 87; break;
+ case "exists": t.kind = 89; break;
default: break;
}
@@ -353,113 +354,113 @@ public class Scanner {
case 7:
{t.kind = 8; goto done;}
case 8:
- {t.kind = 10; goto done;}
+ {t.kind = 11; goto done;}
case 9:
if (ch == '=') {buf.Append(ch); NextCh(); goto case 17;}
else if (ch == ':') {buf.Append(ch); NextCh(); goto case 52;}
- else {t.kind = 11; goto done;}
+ else {t.kind = 12; goto done;}
case 10:
if (ch == '=') {buf.Append(ch); NextCh(); goto case 19;}
- else {t.kind = 12; goto done;}
+ else {t.kind = 13; goto done;}
case 11:
if (ch == '=') {buf.Append(ch); NextCh(); goto case 31;}
- else {t.kind = 13; goto done;}
+ else {t.kind = 14; goto done;}
case 12:
- {t.kind = 21; goto done;}
- case 13:
{t.kind = 22; goto done;}
+ case 13:
+ {t.kind = 23; goto done;}
case 14:
- {t.kind = 32; goto done;}
+ {t.kind = 33; goto done;}
case 15:
if (ch == '>') {buf.Append(ch); NextCh(); goto case 16;}
else if (ch == '=') {buf.Append(ch); NextCh(); goto case 23;}
else {t.kind = noSym; goto done;}
case 16:
- {t.kind = 37; goto done;}
+ {t.kind = 38; goto done;}
case 17:
- {t.kind = 41; goto done;}
+ {t.kind = 42; goto done;}
case 18:
if (ch == '|') {buf.Append(ch); NextCh(); goto case 29;}
- else {t.kind = 49; goto done;}
+ else {t.kind = 50; goto done;}
case 19:
if (ch == '=') {buf.Append(ch); NextCh(); goto case 20;}
- else {t.kind = 61; goto done;}
+ else {t.kind = 62; goto done;}
case 20:
if (ch == '>') {buf.Append(ch); NextCh(); goto case 21;}
else {t.kind = noSym; goto done;}
case 21:
- {t.kind = 52; goto done;}
- case 22:
{t.kind = 53; goto done;}
+ case 22:
+ {t.kind = 54; goto done;}
case 23:
if (ch == '>') {buf.Append(ch); NextCh(); goto case 24;}
- else {t.kind = 60; goto done;}
+ else {t.kind = 61; goto done;}
case 24:
- {t.kind = 54; goto done;}
- case 25:
{t.kind = 55; goto done;}
+ case 25:
+ {t.kind = 56; goto done;}
case 26:
if (ch == '&') {buf.Append(ch); NextCh(); goto case 27;}
else {t.kind = noSym; goto done;}
case 27:
- {t.kind = 56; goto done;}
- case 28:
{t.kind = 57; goto done;}
- case 29:
+ case 28:
{t.kind = 58; goto done;}
- case 30:
+ case 29:
{t.kind = 59; goto done;}
+ case 30:
+ {t.kind = 60; goto done;}
case 31:
- {t.kind = 62; goto done;}
+ {t.kind = 63; goto done;}
case 32:
if (ch == '=') {buf.Append(ch); NextCh(); goto case 33;}
else if (ch == '!') {buf.Append(ch); NextCh(); goto case 34;}
else if (ch == 'i') {buf.Append(ch); NextCh(); goto case 35;}
- else {t.kind = 73; goto done;}
+ else {t.kind = 74; goto done;}
case 33:
- {t.kind = 63; goto done;}
- case 34:
{t.kind = 64; goto done;}
+ case 34:
+ {t.kind = 65; goto done;}
case 35:
if (ch == 'n') {buf.Append(ch); NextCh(); goto case 36;}
else {t.kind = noSym; goto done;}
case 36:
- {t.kind = 65; goto done;}
- case 37:
{t.kind = 66; goto done;}
- case 38:
+ case 37:
{t.kind = 67; goto done;}
- case 39:
+ case 38:
{t.kind = 68; goto done;}
- case 40:
+ case 39:
{t.kind = 69; goto done;}
- case 41:
+ case 40:
{t.kind = 70; goto done;}
- case 42:
+ case 41:
{t.kind = 71; goto done;}
- case 43:
+ case 42:
{t.kind = 72; goto done;}
+ case 43:
+ {t.kind = 73; goto done;}
case 44:
- {t.kind = 74; goto done;}
+ {t.kind = 75; goto done;}
case 45:
- {t.kind = 78; goto done;}
+ {t.kind = 79; goto done;}
case 46:
if (ch == '.') {buf.Append(ch); NextCh(); goto case 49;}
- else {t.kind = 79; goto done;}
+ else {t.kind = 80; goto done;}
case 47:
- {t.kind = 81; goto done;}
- case 48:
{t.kind = 82; goto done;}
- case 49:
+ case 48:
{t.kind = 83; goto done;}
+ case 49:
+ {t.kind = 84; goto done;}
case 50:
- {t.kind = 87; goto done;}
+ {t.kind = 88; goto done;}
case 51:
- {t.kind = 89; goto done;}
- case 52:
{t.kind = 90; goto done;}
- case 53:
+ case 52:
{t.kind = 91; goto done;}
+ case 53:
+ {t.kind = 92; goto done;}
case 54: {t.kind = 0; goto done;}
}
done:
diff --git a/Dafny/Translator.ssc b/Dafny/Translator.ssc
index e490e8b4..ffd76bd6 100644
--- a/Dafny/Translator.ssc
+++ b/Dafny/Translator.ssc
@@ -932,6 +932,7 @@ namespace Microsoft.Dafny {
t1 = Bpl.Expr.Imp(Bpl.Expr.Not(etran.TrExpr(e.E0)), t1);
break;
case BinaryExpr.ResolvedOpcode.Div:
+ case BinaryExpr.ResolvedOpcode.Mod:
z = Bpl.Expr.Neq(etran.TrExpr(e.E1), Bpl.Expr.Literal(0));
break;
default:
@@ -2543,6 +2544,17 @@ namespace Microsoft.Dafny {
}
public static bool ModeledAsBoxType(Type! t) {
+ while (true) {
+ TypeProxy tp = t as TypeProxy;
+ if (tp == null) {
+ break;
+ } else if (tp.T == null) {
+ // unresolved proxy
+ return false;
+ } else {
+ t = tp.T;
+ }
+ }
return t.IsTypeParameter;
}
diff --git a/Util/Emacs/dafny-mode.el b/Util/Emacs/dafny-mode.el
index 9d3ed5e0..d8fe3052 100644
--- a/Util/Emacs/dafny-mode.el
+++ b/Util/Emacs/dafny-mode.el
@@ -30,7 +30,7 @@
]\\)*" . font-lock-comment-face)
`(,(dafny-regexp-opt '(
- "class" "datatype" "function" "frame" "var" "method"
+ "class" "datatype" "function" "frame" "ghost" "var" "method"
"returns" "requires" "ensures" "modifies" "reads" "free"
"invariant" "decreases"
)) . font-lock-builtin-face)
diff --git a/Util/latex/dafny.sty b/Util/latex/dafny.sty
index f334e770..f88c3b54 100644
--- a/Util/latex/dafny.sty
+++ b/Util/latex/dafny.sty
@@ -7,9 +7,9 @@
\lstdefinelanguage{dafny}{
morekeywords={class,datatype,bool,int,object,set,seq,%
function,returns,
- var,
+ ghost,var,
method,in,
- requires,modifies,ensures,reads,free,
+ requires,modifies,ensures,reads,decreases,free,
% expressions
match,case,false,true,null,old,fresh,this,
% statements
@@ -20,15 +20,18 @@
{::}{$\bullet$}2
{:=}{$:$$=$}2
{!}{$\lnot$}1
- {!!}{$\nparallel$}1
+ {!!}{$\not\cap$}1
{==}{$=$}1
{!=}{$\neq$}1
{&&}{$\land$}1
{||}{$\lor$}1
{<=}{$\le$}1
{=>}{$\ge$}1
+ % the following isn't actually Dafny, but it gives the option to produce nicer latex
+ {|=>}{$\Rightarrow$}2
{<=set}{$\subseteq$}1
{+set}{$\cup$}1
+ {*set}{$\cap$}1
{==>}{$\Longrightarrow$}3
{<==>}{$\Longleftrightarrow$}4
{forall}{$\forall$}1
@@ -38,6 +41,7 @@
% the following isn't actually Dafny, but it gives the option to produce nicer latex
{<<}{$\langle$}1
{>>}{$\rangle$}1
+ {...}{$\ldots$}1
{\\alpha}{$\alpha$}1
{\\beta}{$\beta$}1
{\\gamma}{$\gamma$}1