summaryrefslogtreecommitdiff
path: root/Source/Dafny/Parser.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Dafny/Parser.cs')
-rw-r--r--Source/Dafny/Parser.cs2992
1 files changed, 1704 insertions, 1288 deletions
diff --git a/Source/Dafny/Parser.cs b/Source/Dafny/Parser.cs
index 9e283ef5..f64ba7fa 100644
--- a/Source/Dafny/Parser.cs
+++ b/Source/Dafny/Parser.cs
@@ -27,76 +27,181 @@ public class Parser {
public const int _object = 11;
public const int _string = 12;
public const int _set = 13;
- public const int _multiset = 14;
- public const int _seq = 15;
- public const int _map = 16;
- public const int _imap = 17;
- public const int _charToken = 18;
- public const int _stringToken = 19;
- public const int _colon = 20;
- public const int _comma = 21;
- public const int _verticalbar = 22;
- public const int _doublecolon = 23;
- public const int _bullet = 24;
- public const int _dot = 25;
- public const int _semi = 26;
- public const int _darrow = 27;
- public const int _arrow = 28;
- public const int _assume = 29;
- public const int _calc = 30;
- public const int _case = 31;
- public const int _then = 32;
- public const int _else = 33;
- public const int _decreases = 34;
- public const int _invariant = 35;
- public const int _function = 36;
- public const int _predicate = 37;
- public const int _inductive = 38;
- public const int _lemma = 39;
- public const int _copredicate = 40;
- public const int _modifies = 41;
- public const int _reads = 42;
- public const int _requires = 43;
- public const int _lbrace = 44;
- public const int _rbrace = 45;
- public const int _lbracket = 46;
- public const int _rbracket = 47;
- public const int _openparen = 48;
- public const int _closeparen = 49;
- public const int _openAngleBracket = 50;
- public const int _closeAngleBracket = 51;
- public const int _eq = 52;
- public const int _neq = 53;
- public const int _neqAlt = 54;
- public const int _star = 55;
- public const int _notIn = 56;
- public const int _ellipsis = 57;
- public const int maxT = 136;
+ public const int _iset = 14;
+ public const int _multiset = 15;
+ public const int _seq = 16;
+ public const int _map = 17;
+ public const int _imap = 18;
+ public const int _charToken = 19;
+ public const int _stringToken = 20;
+ public const int _colon = 21;
+ public const int _comma = 22;
+ public const int _verticalbar = 23;
+ public const int _doublecolon = 24;
+ public const int _boredSmiley = 25;
+ public const int _bullet = 26;
+ public const int _dot = 27;
+ public const int _semi = 28;
+ public const int _darrow = 29;
+ public const int _arrow = 30;
+ public const int _assume = 31;
+ public const int _calc = 32;
+ public const int _case = 33;
+ public const int _then = 34;
+ public const int _else = 35;
+ public const int _decreases = 36;
+ public const int _invariant = 37;
+ public const int _function = 38;
+ public const int _predicate = 39;
+ public const int _inductive = 40;
+ public const int _lemma = 41;
+ public const int _copredicate = 42;
+ public const int _modifies = 43;
+ public const int _reads = 44;
+ public const int _requires = 45;
+ public const int _lbrace = 46;
+ public const int _rbrace = 47;
+ public const int _lbracket = 48;
+ public const int _rbracket = 49;
+ public const int _openparen = 50;
+ public const int _closeparen = 51;
+ public const int _openAngleBracket = 52;
+ public const int _closeAngleBracket = 53;
+ public const int _eq = 54;
+ public const int _neq = 55;
+ public const int _neqAlt = 56;
+ public const int _star = 57;
+ public const int _notIn = 58;
+ public const int _ellipsis = 59;
+ public const int maxT = 140;
const bool _T = true;
const bool _x = false;
const int minErrDist = 2;
- public Scanner/*!*/ scanner;
- public Errors/*!*/ errors;
+ public Scanner scanner;
+ public Errors errors;
- public Token/*!*/ t; // last recognized token
- public Token/*!*/ la; // lookahead token
+ public Token t; // last recognized token
+ public Token la; // lookahead token
int errDist = minErrDist;
readonly Expression/*!*/ dummyExpr;
readonly AssignmentRhs/*!*/ dummyRhs;
-readonly FrameExpression/*!*/ dummyFrameExpr;
+readonly FrameExpression/*!*/ dummyFrameExpr;
readonly Statement/*!*/ dummyStmt;
readonly ModuleDecl theModule;
readonly BuiltIns theBuiltIns;
readonly bool theVerifyThisFile;
int anonymousIds = 0;
-struct MemberModifiers {
+/// <summary>
+/// Holds the modifiers given for a declaration
+///
+/// Not all modifiers are applicable to all kinds of declarations.
+/// Errors are given when a modify does not apply.
+/// We also record the tokens for the specified modifiers so that
+/// they can be used in error messages.
+/// </summary>
+struct DeclModifierData {
+ public bool IsAbstract;
+ public IToken AbstractToken;
public bool IsGhost;
+ public IToken GhostToken;
public bool IsStatic;
+ public IToken StaticToken;
public bool IsProtected;
+ public IToken ProtectedToken;
+ public bool IsExtern;
+ public IToken ExternToken;
+ public StringLiteralExpr ExternName;
+
+}
+
+// Check that token has not been set, then set it.
+public void CheckAndSetToken(ref IToken token)
+{
+ if (token != null) {
+ SemErr(t, "Duplicate declaration modifier: " + t.val);
+ }
+ token = t;
+}
+
+/// <summary>
+// A flags type used to tell what declaration modifiers are allowed for a declaration.
+/// </summary>
+[Flags]
+enum AllowedDeclModifiers {
+ None = 0,
+ Abstract = 1,
+ Ghost = 2,
+
+ // Means ghost not allowed because already implicitly ghost.
+ AlreadyGhost = 4,
+ Static = 8,
+ Protected = 16,
+ Extern = 32
+};
+
+/// <summary>
+/// Check the declaration modifiers against those that are allowed.
+///
+/// The 'allowed' parameter specifies which declaratio modifiers are allowed.
+/// The 'declCaption' parameter should be a string describing the kind of declaration.
+/// It is used in error messages.
+/// Any declaration modifiers that are present but not allowed are cleared.
+///</summary>
+void CheckDeclModifiers(DeclModifierData dmod, string declCaption, AllowedDeclModifiers allowed)
+{
+ if (dmod.IsAbstract && ((allowed & AllowedDeclModifiers.Abstract) == 0)) {
+ SemErr(dmod.AbstractToken, declCaption + " cannot be declared 'abstract'.");
+ dmod.IsAbstract = false;
+ }
+ if (dmod.IsGhost) {
+ if ((allowed & AllowedDeclModifiers.AlreadyGhost) != 0) {
+ SemErr(dmod.GhostToken, declCaption + " cannot be declared ghost (they are 'ghost' by default).");
+ dmod.IsGhost = false;
+ } else if ((allowed & AllowedDeclModifiers.Ghost) == 0) {
+ SemErr(dmod.GhostToken, declCaption + " cannot be declared 'ghost'.");
+ dmod.IsGhost = false;
+ }
+ }
+ if (dmod.IsStatic && ((allowed & AllowedDeclModifiers.Static) == 0)) {
+ SemErr(dmod.StaticToken, declCaption + " cannot be declared 'static'.");
+ dmod.IsStatic = false;
+ }
+ if (dmod.IsProtected && ((allowed & AllowedDeclModifiers.Protected) == 0)) {
+ SemErr(dmod.ProtectedToken, declCaption + " cannot be declared 'protected'.");
+ dmod.IsProtected = false;
+ }
+ if (dmod.IsExtern && ((allowed & AllowedDeclModifiers.Extern) == 0)) {
+ SemErr(dmod.ExternToken, declCaption + " cannot be declared 'extern'.");
+ dmod.IsExtern = false;
+ }
+}
+
+/// <summary>
+/// Encode an 'extern' declaration modifier as an {:extern name} attribute.
+///
+/// We also include an {:axiom} attribute since the specification of an
+/// external entity is assumed to hold, but only for methods or functions.
+///</summary>
+static void EncodeExternAsAttribute(DeclModifierData dmod, ref Attributes attrs, IToken/*!*/ id, bool needAxiom) {
+ if (dmod.IsExtern) {
+ StringLiteralExpr name = dmod.ExternName;
+ if (name == null) {
+ bool isVerbatimString = false;
+ name = new StringLiteralExpr(id, id.val, isVerbatimString);
+ }
+ var args = new List<Expression>();
+ args.Add(name);
+ attrs = new Attributes("extern", args, attrs);
+
+ // Also 'extern' implies 'axiom' for methods or functions.
+ if (needAxiom) {
+ attrs = new Attributes("axiom", new List<Expression>(), attrs);
+ }
+ }
}
///<summary>
@@ -111,11 +216,11 @@ public static int Parse (string/*!*/ filename, ModuleDecl module, BuiltIns built
string s;
if (filename == "stdin.dfy") {
s = Microsoft.Boogie.ParserHelper.Fill(System.Console.In, new List<string>());
- return Parse(s, filename, module, builtIns, errors, verifyThisFile);
+ return Parse(s, filename, filename, module, builtIns, errors, verifyThisFile);
} else {
using (System.IO.StreamReader reader = new System.IO.StreamReader(filename)) {
s = Microsoft.Boogie.ParserHelper.Fill(reader, new List<string>());
- return Parse(s, DafnyOptions.Clo.UseBaseNameForFileName ? Path.GetFileName(filename) : filename, module, builtIns, errors, verifyThisFile);
+ return Parse(s, filename, DafnyOptions.Clo.UseBaseNameForFileName ? Path.GetFileName(filename) : filename, module, builtIns, errors, verifyThisFile);
}
}
}
@@ -125,12 +230,12 @@ public static int Parse (string/*!*/ filename, ModuleDecl module, BuiltIns built
/// Returns the number of parsing errors encountered.
/// Note: first initialize the Scanner.
///</summary>
-public static int Parse (string/*!*/ s, string/*!*/ filename, ModuleDecl module, BuiltIns builtIns, bool verifyThisFile=true) {
+public static int Parse (string/*!*/ s, string/*!*/ fullFilename, string/*!*/ filename, ModuleDecl module, BuiltIns builtIns, ErrorReporter reporter, bool verifyThisFile=true) {
Contract.Requires(s != null);
Contract.Requires(filename != null);
Contract.Requires(module != null);
- Errors errors = new Errors();
- return Parse(s, filename, module, builtIns, errors, verifyThisFile);
+ Errors errors = new Errors(reporter);
+ return Parse(s, fullFilename, filename, module, builtIns, errors, verifyThisFile);
}
///<summary>
/// Parses top-level things (modules, classes, datatypes, class members)
@@ -138,18 +243,18 @@ public static int Parse (string/*!*/ s, string/*!*/ filename, ModuleDecl module,
/// Returns the number of parsing errors encountered.
/// Note: first initialize the Scanner with the given Errors sink.
///</summary>
-public static int Parse (string/*!*/ s, string/*!*/ filename, ModuleDecl module, BuiltIns builtIns,
- Errors/*!*/ errors, bool verifyThisFile=true) {
+public static int Parse (string/*!*/ s, string/*!*/ fullFilename, string/*!*/ filename, ModuleDecl module,
+ BuiltIns builtIns, Errors/*!*/ errors, bool verifyThisFile=true) {
Contract.Requires(s != null);
Contract.Requires(filename != null);
Contract.Requires(module != null);
Contract.Requires(errors != null);
byte[]/*!*/ buffer = cce.NonNull( UTF8Encoding.Default.GetBytes(s));
MemoryStream ms = new MemoryStream(buffer,false);
- Scanner scanner = new Scanner(ms, errors, filename);
+ Scanner scanner = new Scanner(ms, errors, fullFilename, filename);
Parser parser = new Parser(scanner, errors, module, builtIns, verifyThisFile);
parser.Parse();
- return parser.errors.count;
+ return parser.errors.ErrorCount;
}
public Parser(Scanner/*!*/ scanner, Errors/*!*/ errors, ModuleDecl module, BuiltIns builtIns, bool verifyThisFile=true)
: this(scanner, errors) // the real work
@@ -174,6 +279,25 @@ bool IsAlternative() {
return la.kind == _lbrace && x.kind == _case;
}
+// an existential guard starts with an identifier and is then followed by
+// * a colon (if the first identifier is given an explicit type),
+// * a comma (if there's a list a bound variables and the first one is not given an explicit type),
+// * a start-attribute (if there's one bound variable and it is not given an explicit type and there are attributes), or
+// * a bored smiley (if there's one bound variable and it is not given an explicit type).
+bool IsExistentialGuard() {
+ scanner.ResetPeek();
+ if (la.kind == _ident) {
+ Token x = scanner.Peek();
+ if (x.kind == _colon || x.kind == _comma || x.kind == _boredSmiley) {
+ return true;
+ } else if (x.kind == _lbrace) {
+ x = scanner.Peek();
+ return x.kind == _colon;
+ }
+ }
+ return false;
+}
+
bool IsLoopSpec() {
return la.kind == _invariant | la.kind == _decreases | la.kind == _modifies;
}
@@ -245,6 +369,9 @@ bool IsMapDisplay() {
bool IsIMapDisplay() {
return la.kind == _imap && scanner.Peek().kind == _lbracket;
}
+bool IsISetDisplay() {
+ return la.kind == _iset && scanner.Peek().kind == _lbrace;
+}
bool IsSuffix() {
return la.kind == _dot || la.kind == _lbracket || la.kind == _openparen;
@@ -366,6 +493,9 @@ bool IsGenericInstantiation() {
return false;
}
}
+/* Returns true if the next thing is of the form:
+ * "<" Type { "," Type } ">"
+ */
bool IsTypeList(ref IToken pt) {
if (pt.kind != _openAngleBracket) {
return false;
@@ -373,6 +503,10 @@ bool IsTypeList(ref IToken pt) {
pt = scanner.Peek();
return IsTypeSequence(ref pt, _closeAngleBracket);
}
+/* Returns true if the next thing is of the form:
+ * Type { "," Type }
+ * followed by an endBracketKind.
+ */
bool IsTypeSequence(ref IToken pt, int endBracketKind) {
while (true) {
if (!IsType(ref pt)) {
@@ -404,12 +538,13 @@ bool IsType(ref IToken pt) {
return true;
case _arrayToken:
case _set:
+ case _iset:
case _multiset:
case _seq:
case _map:
case _imap:
pt = scanner.Peek();
- return IsTypeList(ref pt);
+ return pt.kind != _openAngleBracket || IsTypeList(ref pt);
case _ident:
while (true) {
// invariant: next token is an ident
@@ -428,19 +563,31 @@ bool IsType(ref IToken pt) {
}
case _openparen:
pt = scanner.Peek();
+ if (pt.kind == _closeparen) {
+ // end of type list
+ pt = scanner.Peek();
+ return true;
+ }
return IsTypeSequence(ref pt, _closeparen);
default:
return false;
}
}
+
+bool IsDefaultImport() {
+ scanner.ResetPeek();
+ Token x = scanner.Peek(); // lookahead token again
+ return la.val == "default" && x.val != "export";
+}
+
/*--------------------------------------------------------------------------*/
- public Parser(Scanner/*!*/ scanner, Errors/*!*/ errors) {
+ public Parser(Scanner scanner, Errors errors) {
this.scanner = scanner;
this.errors = errors;
- Token/*!*/ tok = new Token();
+ Token tok = new Token();
tok.val = "";
this.la = tok;
this.t = new Token(); // just to satisfy its non-null constraint
@@ -451,13 +598,13 @@ bool IsType(ref IToken pt) {
errDist = 0;
}
- public void SemErr (string/*!*/ msg) {
+ public void SemErr (string msg) {
Contract.Requires(msg != null);
if (errDist >= minErrDist) errors.SemErr(t, msg);
errDist = 0;
}
- public void SemErr(IToken/*!*/ tok, string/*!*/ msg) {
+ public void SemErr(IToken tok, string msg) {
Contract.Requires(tok != null);
Contract.Requires(msg != null);
errors.SemErr(tok, msg);
@@ -506,20 +653,17 @@ bool IsType(ref IToken pt) {
void Dafny() {
- ClassDecl/*!*/ c; DatatypeDecl/*!*/ dt; TopLevelDecl td; IteratorDecl iter;
List<MemberDecl/*!*/> membersDefaultClass = new List<MemberDecl/*!*/>();
- ModuleDecl submodule;
// to support multiple files, create a default module only if theModule is null
DefaultModuleDecl defaultModule = (DefaultModuleDecl)((LiteralModuleDecl)theModule).ModuleDef;
// theModule should be a DefaultModuleDecl (actually, the singular DefaultModuleDecl)
- TraitDecl/*!*/ trait;
Contract.Assert(defaultModule != null);
- while (la.kind == 58) {
+ while (la.kind == 60) {
Get();
- Expect(19);
+ Expect(20);
{
- string parsedFile = t.filename;
+ string parsedFile = scanner.FullFilename;
bool isVerbatimString;
string includedFile = Util.RemoveParsedStringQuotes(t.val, out isVerbatimString);
includedFile = Util.RemoveEscaping(includedFile, isVerbatimString);
@@ -534,47 +678,7 @@ bool IsType(ref IToken pt) {
}
while (StartOf(1)) {
- switch (la.kind) {
- case 59: case 60: case 62: {
- SubModuleDecl(defaultModule, out submodule);
- defaultModule.TopLevelDecls.Add(submodule);
- break;
- }
- case 67: {
- ClassDecl(defaultModule, out c);
- defaultModule.TopLevelDecls.Add(c);
- break;
- }
- case 73: case 74: {
- DatatypeDecl(defaultModule, out dt);
- defaultModule.TopLevelDecls.Add(dt);
- break;
- }
- case 76: {
- NewtypeDecl(defaultModule, out td);
- defaultModule.TopLevelDecls.Add(td);
- break;
- }
- case 77: {
- OtherTypeDecl(defaultModule, out td);
- defaultModule.TopLevelDecls.Add(td);
- break;
- }
- case 78: {
- IteratorDecl(defaultModule, out iter);
- defaultModule.TopLevelDecls.Add(iter);
- break;
- }
- case 69: {
- TraitDecl(defaultModule, out trait);
- defaultModule.TopLevelDecls.Add(trait);
- break;
- }
- case 36: case 37: case 38: case 39: case 40: case 70: case 71: case 72: case 75: case 81: case 82: case 83: case 84: {
- ClassMemberDecl(membersDefaultClass, false, !DafnyOptions.O.AllowGlobals);
- break;
- }
- }
+ TopDecl(defaultModule, membersDefaultClass, /* isTopLevel */ true, /* isAbstract */ false);
}
DefaultClassDecl defaultClass = null;
foreach (TopLevelDecl topleveldecl in defaultModule.TopLevelDecls) {
@@ -591,106 +695,162 @@ bool IsType(ref IToken pt) {
Expect(0);
}
- void SubModuleDecl(ModuleDefinition parent, out ModuleDecl submodule) {
+ void TopDecl(ModuleDefinition module, List<MemberDecl/*!*/> membersDefaultClass, bool isTopLevel, bool isAbstract ) {
+ DeclModifierData dmod = new DeclModifierData(); ModuleDecl submodule;
ClassDecl/*!*/ c; DatatypeDecl/*!*/ dt; TopLevelDecl td; IteratorDecl iter;
- Attributes attrs = null; IToken/*!*/ id;
TraitDecl/*!*/ trait;
+
+ while (StartOf(2)) {
+ DeclModifier(ref dmod);
+ }
+ switch (la.kind) {
+ case 66: case 69: case 73: case 74: {
+ SubModuleDecl(dmod, module, out submodule);
+ module.TopLevelDecls.Add(submodule);
+ break;
+ }
+ case 77: {
+ ClassDecl(dmod, module, out c);
+ module.TopLevelDecls.Add(c);
+ break;
+ }
+ case 79: case 80: {
+ DatatypeDecl(dmod, module, out dt);
+ module.TopLevelDecls.Add(dt);
+ break;
+ }
+ case 82: {
+ NewtypeDecl(dmod, module, out td);
+ module.TopLevelDecls.Add(td);
+ break;
+ }
+ case 83: {
+ OtherTypeDecl(dmod, module, out td);
+ module.TopLevelDecls.Add(td);
+ break;
+ }
+ case 84: {
+ IteratorDecl(dmod, module, out iter);
+ module.TopLevelDecls.Add(iter);
+ break;
+ }
+ case 78: {
+ TraitDecl(dmod, module, out trait);
+ module.TopLevelDecls.Add(trait);
+ break;
+ }
+ case 38: case 39: case 40: case 41: case 42: case 81: case 87: case 88: case 89: case 90: {
+ ClassMemberDecl(dmod, membersDefaultClass, false, !DafnyOptions.O.AllowGlobals,
+!isTopLevel && DafnyOptions.O.IronDafny && isAbstract);
+ break;
+ }
+ default: SynErr(141); break;
+ }
+ }
+
+ void DeclModifier(ref DeclModifierData dmod) {
+ if (la.kind == 61) {
+ Get();
+ dmod.IsAbstract = true; CheckAndSetToken(ref dmod.AbstractToken);
+ } else if (la.kind == 62) {
+ Get();
+ dmod.IsGhost = true; CheckAndSetToken(ref dmod.GhostToken);
+ } else if (la.kind == 63) {
+ Get();
+ dmod.IsStatic = true; CheckAndSetToken(ref dmod.StaticToken);
+ } else if (la.kind == 64) {
+ Get();
+ dmod.IsProtected = true; CheckAndSetToken(ref dmod.ProtectedToken);
+ } else if (la.kind == 65) {
+ Get();
+ dmod.IsExtern = true; CheckAndSetToken(ref dmod.ExternToken);
+ if (la.kind == 20) {
+ Get();
+ bool isVerbatimString;
+ string s = Util.RemoveParsedStringQuotes(t.val, out isVerbatimString);
+ dmod.ExternName = new StringLiteralExpr(t, s, isVerbatimString);
+
+ }
+ } else SynErr(142);
+ }
+
+ void SubModuleDecl(DeclModifierData dmod, ModuleDefinition parent, out ModuleDecl submodule) {
+ Attributes attrs = null; IToken/*!*/ id;
List<MemberDecl/*!*/> namedModuleDefaultClassMembers = new List<MemberDecl>();;
List<IToken> idRefined = null, idPath = null, idAssignment = null;
ModuleDefinition module;
- ModuleDecl sm;
submodule = null; // appease compiler
- bool isAbstract = false;
+ bool isAbstract = dmod.IsAbstract;
+ bool isExclusively = false;
bool opened = false;
+ CheckDeclModifiers(dmod, "Modules", AllowedDeclModifiers.Abstract | AllowedDeclModifiers.Extern);
- if (la.kind == 59 || la.kind == 60) {
- if (la.kind == 59) {
- Get();
- isAbstract = true;
- }
- Expect(60);
- while (la.kind == 44) {
+ if (la.kind == 66) {
+ Get();
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 61) {
- Get();
- QualifiedModuleName(out idRefined);
+ EncodeExternAsAttribute(dmod, ref attrs, id, /* needAxiom */ false);
+ if (la.kind == 67 || la.kind == 68) {
+ if (la.kind == 67) {
+ Get();
+ Expect(68);
+ QualifiedModuleName(out idRefined);
+ isExclusively = true;
+ } else {
+ Get();
+ QualifiedModuleName(out idRefined);
+ isExclusively = false;
+ }
}
- module = new ModuleDefinition(id, id.val, isAbstract, false, idRefined == null ? null : idRefined, parent, attrs, false);
- Expect(44);
+ module = new ModuleDefinition(id, id.val, isAbstract, false, isExclusively, idRefined == null ? null : idRefined, parent, attrs, false, this);
+ Expect(46);
module.BodyStartTok = t;
while (StartOf(1)) {
- switch (la.kind) {
- case 59: case 60: case 62: {
- SubModuleDecl(module, out sm);
- module.TopLevelDecls.Add(sm);
- break;
- }
- case 67: {
- ClassDecl(module, out c);
- module.TopLevelDecls.Add(c);
- break;
- }
- case 69: {
- TraitDecl(module, out trait);
- module.TopLevelDecls.Add(trait);
- break;
- }
- case 73: case 74: {
- DatatypeDecl(module, out dt);
- module.TopLevelDecls.Add(dt);
- break;
- }
- case 76: {
- NewtypeDecl(module, out td);
- module.TopLevelDecls.Add(td);
- break;
- }
- case 77: {
- OtherTypeDecl(module, out td);
- module.TopLevelDecls.Add(td);
- break;
- }
- case 78: {
- IteratorDecl(module, out iter);
- module.TopLevelDecls.Add(iter);
- break;
- }
- case 36: case 37: case 38: case 39: case 40: case 70: case 71: case 72: case 75: case 81: case 82: case 83: case 84: {
- ClassMemberDecl(namedModuleDefaultClassMembers, false, !DafnyOptions.O.AllowGlobals);
- break;
- }
- }
+ TopDecl(module, namedModuleDefaultClassMembers, /* isTopLevel */ false, isAbstract);
}
- Expect(45);
+ Expect(47);
module.BodyEndTok = t;
module.TopLevelDecls.Add(new DefaultClassDecl(module, namedModuleDefaultClassMembers));
submodule = new LiteralModuleDecl(module, parent);
- } else if (la.kind == 62) {
+ } else if (la.kind == 69) {
Get();
- if (la.kind == 63) {
+ if (la.kind == 70) {
Get();
opened = true;
}
NoUSIdent(out id);
- if (la.kind == 64 || la.kind == 65) {
- if (la.kind == 64) {
+ EncodeExternAsAttribute(dmod, ref attrs, id, /* needAxiom */ false);
+ if (StartOf(3)) {
+ if (la.kind == 71) {
Get();
QualifiedModuleName(out idPath);
submodule = new AliasModuleDecl(idPath, id, parent, opened);
- } else {
+ } else if (la.kind == 72) {
Get();
QualifiedModuleName(out idPath);
- if (la.kind == 66) {
- Get();
+ if (IsDefaultImport()) {
+ Expect(73);
QualifiedModuleName(out idAssignment);
}
submodule = new ModuleFacadeDecl(idPath, id, parent, idAssignment, opened);
+ errors.Warning(t, "\"import A as B\" has been deprecated; in the new syntax, it is \"import A:B\"");
+
+ } else if (la.kind == 21) {
+ Get();
+ QualifiedModuleName(out idPath);
+ submodule = new ModuleFacadeDecl(idPath, id, parent, idAssignment, opened);
+ } else {
+ Get();
+ QualifiedModuleName(out idPath);
+ idPath.Insert(0, id);
+ submodule = new AliasModuleDecl(idPath, id, parent, opened);
+
}
}
- if (la.kind == 26) {
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(137); Get();}
+ if (la.kind == 28) {
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(143); Get();}
Get();
errors.Warning(t, "the semi-colon that used to terminate a sub-module declaration has been deprecated; in the new syntax, just leave off the semi-colon");
}
@@ -700,10 +860,54 @@ bool IsType(ref IToken pt) {
submodule = new AliasModuleDecl(idPath, id, parent, opened);
}
- } else SynErr(138);
+ } else if (la.kind == 73 || la.kind == 74) {
+ bool isDefault = false;
+ bool includeBody;
+ IToken exportId;
+ List<ExportSignature> exports = new List<ExportSignature>();;
+ List<string> extends = new List<string>();
+
+ if (la.kind == 73) {
+ Get();
+ isDefault = true;
+ }
+ Expect(74);
+ NoUSIdent(out exportId);
+ if (la.kind == 75) {
+ Get();
+ NoUSIdent(out id);
+ extends.Add(id.val);
+ while (la.kind == 22) {
+ Get();
+ NoUSIdent(out id);
+ extends.Add(id.val);
+ }
+ }
+ Expect(46);
+ NoUSIdent(out id);
+ includeBody = false;
+ if (la.kind == 76) {
+ Get();
+ includeBody = true;
+ }
+ exports.Add(new ExportSignature(id, includeBody));
+ while (la.kind == 22) {
+ Get();
+ NoUSIdent(out id);
+ includeBody = false;
+ if (la.kind == 76) {
+ Get();
+ includeBody = true;
+ }
+ exports.Add(new ExportSignature(id, includeBody));
+ }
+ Expect(47);
+ submodule = new ModuleExportDecl(exportId, parent, isDefault, exports, extends);
+
+ } else SynErr(144);
}
- void ClassDecl(ModuleDefinition/*!*/ module, out ClassDecl/*!*/ c) {
+ void ClassDecl(DeclModifierData dmodClass, ModuleDefinition/*!*/ module, out ClassDecl/*!*/ c) {
Contract.Requires(module != null);
Contract.Ensures(Contract.ValueAtReturn(out c) != null);
IToken/*!*/ id;
@@ -713,39 +917,46 @@ bool IsType(ref IToken pt) {
List<TypeParameter/*!*/> typeArgs = new List<TypeParameter/*!*/>();
List<MemberDecl/*!*/> members = new List<MemberDecl/*!*/>();
IToken bodyStart;
+ CheckDeclModifiers(dmodClass, "Classes", AllowedDeclModifiers.Extern);
+ DeclModifierData dmod;
- while (!(la.kind == 0 || la.kind == 67)) {SynErr(139); Get();}
- Expect(67);
- while (la.kind == 44) {
+ while (!(la.kind == 0 || la.kind == 77)) {SynErr(145); Get();}
+ Expect(77);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 50) {
+ EncodeExternAsAttribute(dmodClass, ref attrs, id, /* needAxiom */ false);
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
- if (la.kind == 68) {
+ if (la.kind == 75) {
Get();
Type(out trait);
traits.Add(trait);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Type(out trait);
traits.Add(trait);
}
}
- Expect(44);
+ Expect(46);
bodyStart = t;
- while (StartOf(2)) {
- ClassMemberDecl(members, true, false);
+ while (StartOf(4)) {
+ dmod = new DeclModifierData();
+ while (StartOf(2)) {
+ DeclModifier(ref dmod);
+ }
+ ClassMemberDecl(dmod, members, true, false, false);
}
- Expect(45);
+ Expect(47);
c = new ClassDecl(id, id.val, module, typeArgs, members, attrs, traits);
c.BodyStartTok = bodyStart;
c.BodyEndTok = t;
}
- void DatatypeDecl(ModuleDefinition/*!*/ module, out DatatypeDecl/*!*/ dt) {
+ void DatatypeDecl(DeclModifierData dmod, ModuleDefinition/*!*/ module, out DatatypeDecl/*!*/ dt) {
Contract.Requires(module != null);
Contract.Ensures(Contract.ValueAtReturn(out dt)!=null);
IToken/*!*/ id;
@@ -754,30 +965,31 @@ bool IsType(ref IToken pt) {
List<DatatypeCtor/*!*/> ctors = new List<DatatypeCtor/*!*/>();
IToken bodyStart = Token.NoToken; // dummy assignment
bool co = false;
+ CheckDeclModifiers(dmod, "Datatypes or codatatypes", AllowedDeclModifiers.None);
- while (!(la.kind == 0 || la.kind == 73 || la.kind == 74)) {SynErr(140); Get();}
- if (la.kind == 73) {
+ while (!(la.kind == 0 || la.kind == 79 || la.kind == 80)) {SynErr(146); Get();}
+ if (la.kind == 79) {
Get();
- } else if (la.kind == 74) {
+ } else if (la.kind == 80) {
Get();
co = true;
- } else SynErr(141);
- while (la.kind == 44) {
+ } else SynErr(147);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
- Expect(64);
+ Expect(71);
bodyStart = t;
DatatypeMemberDecl(ctors);
- while (la.kind == 22) {
+ while (la.kind == 23) {
Get();
DatatypeMemberDecl(ctors);
}
- if (la.kind == 26) {
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(142); Get();}
+ if (la.kind == 28) {
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(148); Get();}
Get();
errors.Warning(t, "the semi-colon that used to terminate a (co)datatype declaration has been deprecated; in the new syntax, just leave off the semi-colon");
}
@@ -791,78 +1003,80 @@ bool IsType(ref IToken pt) {
}
- void NewtypeDecl(ModuleDefinition module, out TopLevelDecl td) {
+ void NewtypeDecl(DeclModifierData dmod, ModuleDefinition module, out TopLevelDecl td) {
IToken id, bvId;
Attributes attrs = null;
td = null;
Type baseType = null;
Expression wh;
+ CheckDeclModifiers(dmod, "Newtypes", AllowedDeclModifiers.None);
- Expect(76);
- while (la.kind == 44) {
+ Expect(82);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- Expect(64);
+ Expect(71);
if (IsIdentColonOrBar()) {
NoUSIdent(out bvId);
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
Type(out baseType);
}
- if (baseType == null) { baseType = new OperationTypeProxy(true, true, false, false, false); }
- Expect(22);
+ if (baseType == null) { baseType = new OperationTypeProxy(true, true, false, false, false, false); }
+ Expect(23);
Expression(out wh, false, true);
td = new NewtypeDecl(theVerifyThisFile ? id : new IncludeToken(id), id.val, module, new BoundVar(bvId, bvId.val, baseType), wh, attrs);
- } else if (StartOf(3)) {
+ } else if (StartOf(5)) {
Type(out baseType);
td = new NewtypeDecl(theVerifyThisFile ? id : new IncludeToken(id), id.val, module, baseType, attrs);
- } else SynErr(143);
+ } else SynErr(149);
}
- void OtherTypeDecl(ModuleDefinition module, out TopLevelDecl td) {
+ void OtherTypeDecl(DeclModifierData dmod, ModuleDefinition module, out TopLevelDecl td) {
IToken id;
Attributes attrs = null;
var eqSupport = TypeParameter.EqualitySupportValue.Unspecified;
var typeArgs = new List<TypeParameter>();
td = null;
Type ty;
+ CheckDeclModifiers(dmod, "Type aliases", AllowedDeclModifiers.None);
- Expect(77);
- while (la.kind == 44) {
+ Expect(83);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 48) {
+ if (la.kind == 50) {
Get();
- Expect(52);
- Expect(49);
+ Expect(54);
+ Expect(51);
eqSupport = TypeParameter.EqualitySupportValue.Required;
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
- } else if (StartOf(4)) {
- if (la.kind == 50) {
+ } else if (StartOf(6)) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
- if (la.kind == 64) {
+ if (la.kind == 71) {
Get();
Type(out ty);
td = new TypeSynonymDecl(id, id.val, typeArgs, module, ty, attrs);
}
- } else SynErr(144);
+ } else SynErr(150);
if (td == null) {
td = new OpaqueTypeDecl(id, id.val, module, eqSupport, typeArgs, attrs);
}
- if (la.kind == 26) {
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(145); Get();}
+ if (la.kind == 28) {
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(151); Get();}
Get();
errors.Warning(t, "the semi-colon that used to terminate an opaque-type declaration has been deprecated; in the new syntax, just leave off the semi-colon");
}
}
- void IteratorDecl(ModuleDefinition module, out IteratorDecl/*!*/ iter) {
+ void IteratorDecl(DeclModifierData dmod, ModuleDefinition module, out IteratorDecl/*!*/ iter) {
Contract.Ensures(Contract.ValueAtReturn(out iter) != null);
IToken/*!*/ id;
Attributes attrs = null;
@@ -884,20 +1098,21 @@ bool IsType(ref IToken pt) {
IToken signatureEllipsis = null;
IToken bodyStart = Token.NoToken;
IToken bodyEnd = Token.NoToken;
+ CheckDeclModifiers(dmod, "Iterators", AllowedDeclModifiers.None);
- while (!(la.kind == 0 || la.kind == 78)) {SynErr(146); Get();}
- Expect(78);
- while (la.kind == 44) {
+ while (!(la.kind == 0 || la.kind == 84)) {SynErr(152); Get();}
+ Expect(84);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 48 || la.kind == 50) {
- if (la.kind == 50) {
+ if (la.kind == 50 || la.kind == 52) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
Formals(true, true, ins);
- if (la.kind == 79 || la.kind == 80) {
- if (la.kind == 79) {
+ if (la.kind == 85 || la.kind == 86) {
+ if (la.kind == 85) {
Get();
} else {
Get();
@@ -905,14 +1120,14 @@ bool IsType(ref IToken pt) {
}
Formals(false, true, outs);
}
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
signatureEllipsis = t;
- } else SynErr(147);
- while (StartOf(5)) {
+ } else SynErr(153);
+ while (StartOf(7)) {
IteratorSpec(reads, mod, decreases, req, ens, yieldReq, yieldEns, ref readsAttrs, ref modAttrs, ref decrAttrs);
}
- if (la.kind == 44) {
+ if (la.kind == 46) {
BlockStmt(out body, out bodyStart, out bodyEnd);
}
iter = new IteratorDecl(id, id.val, module, typeArgs, ins, outs,
@@ -926,98 +1141,85 @@ bool IsType(ref IToken pt) {
}
- void TraitDecl(ModuleDefinition/*!*/ module, out TraitDecl/*!*/ trait) {
- Contract.Requires(module != null);
+ void TraitDecl(DeclModifierData dmodIn, ModuleDefinition/*!*/ module, out TraitDecl/*!*/ trait) {
+ Contract.Requires(module != null);
Contract.Ensures(Contract.ValueAtReturn(out trait) != null);
+ CheckDeclModifiers(dmodIn, "Traits", AllowedDeclModifiers.None);
IToken/*!*/ id;
Attributes attrs = null;
List<TypeParameter/*!*/> typeArgs = new List<TypeParameter/*!*/>(); //traits should not support type parameters at the moment
List<MemberDecl/*!*/> members = new List<MemberDecl/*!*/>();
IToken bodyStart;
+ DeclModifierData dmod;
- while (!(la.kind == 0 || la.kind == 69)) {SynErr(148); Get();}
- Expect(69);
- while (la.kind == 44) {
+ while (!(la.kind == 0 || la.kind == 78)) {SynErr(154); Get();}
+ Expect(78);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
- Expect(44);
+ Expect(46);
bodyStart = t;
- while (StartOf(2)) {
- ClassMemberDecl(members, true, false);
+ while (StartOf(4)) {
+ dmod = new DeclModifierData();
+ while (StartOf(2)) {
+ DeclModifier(ref dmod);
+ }
+ ClassMemberDecl(dmod, members, true, false, false);
}
- Expect(45);
+ Expect(47);
trait = new TraitDecl(id, id.val, module, typeArgs, members, attrs);
trait.BodyStartTok = bodyStart;
trait.BodyEndTok = t;
}
- void ClassMemberDecl(List<MemberDecl> mm, bool allowConstructors, bool moduleLevelDecl) {
+ void ClassMemberDecl(DeclModifierData dmod, List<MemberDecl> mm, bool allowConstructors, bool moduleLevelDecl, bool isWithinAbstractModule) {
Contract.Requires(cce.NonNullElements(mm));
Method/*!*/ m;
Function/*!*/ f;
- MemberModifiers mmod = new MemberModifiers();
- IToken staticToken = null, protectedToken = null;
- while (la.kind == 70 || la.kind == 71 || la.kind == 72) {
- if (la.kind == 70) {
- Get();
- mmod.IsGhost = true;
- } else if (la.kind == 71) {
- Get();
- mmod.IsStatic = true; staticToken = t;
- } else {
- Get();
- mmod.IsProtected = true; protectedToken = t;
- }
- }
- if (la.kind == 75) {
+ if (la.kind == 81) {
if (moduleLevelDecl) {
SemErr(la, "fields are not allowed to be declared at the module level; instead, wrap the field in a 'class' declaration");
- mmod.IsStatic = false;
- mmod.IsProtected = false;
+ dmod.IsStatic = false;
}
- FieldDecl(mmod, mm);
+ FieldDecl(dmod, mm);
} else if (IsFunctionDecl()) {
- if (moduleLevelDecl && staticToken != null) {
- errors.Warning(staticToken, "module-level functions are always non-instance, so the 'static' keyword is not allowed here");
- mmod.IsStatic = false;
+ if (moduleLevelDecl && dmod.StaticToken != null) {
+ errors.Warning(dmod.StaticToken, "module-level functions are always non-instance, so the 'static' keyword is not allowed here");
+ dmod.IsStatic = false;
}
- FunctionDecl(mmod, out f);
+ FunctionDecl(dmod, isWithinAbstractModule, out f);
mm.Add(f);
- } else if (StartOf(6)) {
- if (moduleLevelDecl && staticToken != null) {
- errors.Warning(staticToken, "module-level methods are always non-instance, so the 'static' keyword is not allowed here");
- mmod.IsStatic = false;
- }
- if (protectedToken != null) {
- SemErr(protectedToken, "only functions, not methods, can be declared 'protected'");
- mmod.IsProtected = false;
+ } else if (StartOf(8)) {
+ if (moduleLevelDecl && dmod.StaticToken != null) {
+ errors.Warning(dmod.StaticToken, "module-level methods are always non-instance, so the 'static' keyword is not allowed here");
+ dmod.IsStatic = false;
}
- MethodDecl(mmod, allowConstructors, out m);
+ MethodDecl(dmod, allowConstructors, isWithinAbstractModule, out m);
mm.Add(m);
- } else SynErr(149);
+ } else SynErr(155);
}
void Attribute(ref Attributes attrs) {
- string name;
+ IToken x; string name;
var args = new List<Expression>();
- Expect(44);
- Expect(20);
- Expect(1);
- name = t.val;
- if (StartOf(7)) {
+ Expect(46);
+ Expect(21);
+ NoUSIdent(out x);
+ name = x.val;
+ if (StartOf(9)) {
Expressions(args);
}
- Expect(45);
+ Expect(47);
attrs = new Attributes(name, args, attrs);
}
@@ -1035,7 +1237,7 @@ bool IsType(ref IToken pt) {
IToken id; ids = new List<IToken>();
Ident(out id);
ids.Add(id);
- while (la.kind == 25) {
+ while (la.kind == 27) {
Get();
Ident(out id);
ids.Add(id);
@@ -1053,29 +1255,29 @@ bool IsType(ref IToken pt) {
IToken/*!*/ id;
TypeParameter.EqualitySupportValue eqSupport;
- Expect(50);
+ Expect(52);
NoUSIdent(out id);
eqSupport = TypeParameter.EqualitySupportValue.Unspecified;
- if (la.kind == 48) {
+ if (la.kind == 50) {
Get();
- Expect(52);
- Expect(49);
+ Expect(54);
+ Expect(51);
eqSupport = TypeParameter.EqualitySupportValue.Required;
}
typeArgs.Add(new TypeParameter(id, id.val, eqSupport));
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
NoUSIdent(out id);
eqSupport = TypeParameter.EqualitySupportValue.Unspecified;
- if (la.kind == 48) {
+ if (la.kind == 50) {
Get();
- Expect(52);
- Expect(49);
+ Expect(54);
+ Expect(51);
eqSupport = TypeParameter.EqualitySupportValue.Required;
}
typeArgs.Add(new TypeParameter(id, id.val, eqSupport));
}
- Expect(51);
+ Expect(53);
}
void Type(out Type ty) {
@@ -1083,29 +1285,28 @@ bool IsType(ref IToken pt) {
TypeAndToken(out tok, out ty);
}
- void FieldDecl(MemberModifiers mmod, List<MemberDecl/*!*/>/*!*/ mm) {
+ void FieldDecl(DeclModifierData dmod, List<MemberDecl/*!*/>/*!*/ mm) {
Contract.Requires(cce.NonNullElements(mm));
Attributes attrs = null;
IToken/*!*/ id; Type/*!*/ ty;
+ CheckDeclModifiers(dmod, "Fields", AllowedDeclModifiers.Ghost);
- while (!(la.kind == 0 || la.kind == 75)) {SynErr(150); Get();}
- Expect(75);
- if (mmod.IsStatic) { SemErr(t, "fields cannot be declared 'static'"); }
-
- while (la.kind == 44) {
+ while (!(la.kind == 0 || la.kind == 81)) {SynErr(156); Get();}
+ Expect(81);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
FIdentType(out id, out ty);
- mm.Add(new Field(id, id.val, mmod.IsGhost, ty, attrs));
- while (la.kind == 21) {
+ mm.Add(new Field(id, id.val, dmod.IsGhost, ty, attrs));
+ while (la.kind == 22) {
Get();
FIdentType(out id, out ty);
- mm.Add(new Field(id, id.val, mmod.IsGhost, ty, attrs));
+ mm.Add(new Field(id, id.val, dmod.IsGhost, ty, attrs));
}
OldSemi();
}
- void FunctionDecl(MemberModifiers mmod, out Function/*!*/ f) {
+ void FunctionDecl(DeclModifierData dmod, bool isWithinAbstractModule, out Function/*!*/ f) {
Contract.Ensures(Contract.ValueAtReturn(out f)!=null);
Attributes attrs = null;
IToken/*!*/ id = Token.NoToken; // to please compiler
@@ -1124,129 +1325,144 @@ bool IsType(ref IToken pt) {
IToken signatureEllipsis = null;
bool missingOpenParen;
- if (la.kind == 36) {
+ if (la.kind == 38) {
Get();
- if (la.kind == 81) {
+ if (la.kind == 87) {
Get();
isFunctionMethod = true;
}
- if (mmod.IsGhost) { SemErr(t, "functions cannot be declared 'ghost' (they are ghost by default)"); }
+ AllowedDeclModifiers allowed = AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static | AllowedDeclModifiers.Protected;
+ string caption = "Functions";
+ if (isFunctionMethod) {
+ allowed |= AllowedDeclModifiers.Extern;
+ caption = "Function methods";
+ }
+ CheckDeclModifiers(dmod, caption, allowed);
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 48 || la.kind == 50) {
- if (la.kind == 50) {
+ if (la.kind == 50 || la.kind == 52) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
Formals(true, isFunctionMethod, formals);
- Expect(20);
+ Expect(21);
Type(out returnType);
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
signatureEllipsis = t;
- } else SynErr(151);
- } else if (la.kind == 37) {
+ } else SynErr(157);
+ } else if (la.kind == 39) {
Get();
isPredicate = true;
- if (la.kind == 81) {
+ if (la.kind == 87) {
Get();
isFunctionMethod = true;
}
- if (mmod.IsGhost) { SemErr(t, "predicates cannot be declared 'ghost' (they are ghost by default)"); }
+ AllowedDeclModifiers allowed = AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static | AllowedDeclModifiers.Protected;
+ string caption = "Predicates";
+ if (isFunctionMethod) {
+ allowed |= AllowedDeclModifiers.Extern;
+ caption = "Predicate methods";
+ }
+ CheckDeclModifiers(dmod, caption, allowed);
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (StartOf(8)) {
- if (la.kind == 50) {
+ if (StartOf(10)) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
missingOpenParen = true;
- if (la.kind == 48) {
+ if (la.kind == 50) {
Formals(true, isFunctionMethod, formals);
missingOpenParen = false;
}
if (missingOpenParen) { errors.Warning(t, "with the new support of higher-order functions in Dafny, parentheses-less predicates are no longer supported; in the new syntax, parentheses are required for the declaration and uses of predicates, even if the predicate takes no additional arguments"); }
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
SemErr(t, "predicates do not have an explicitly declared return type; it is always bool");
}
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
signatureEllipsis = t;
- } else SynErr(152);
- } else if (la.kind == 38) {
+ } else SynErr(158);
+ } else if (la.kind == 40) {
Get();
- Expect(37);
+ Expect(39);
isIndPredicate = true;
- if (mmod.IsGhost) { SemErr(t, "inductive predicates cannot be declared 'ghost' (they are ghost by default)"); }
+ CheckDeclModifiers(dmod, "Inductive predicates",
+ AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static | AllowedDeclModifiers.Protected);
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 48 || la.kind == 50) {
- if (la.kind == 50) {
+ if (la.kind == 50 || la.kind == 52) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
Formals(true, isFunctionMethod, formals);
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
SemErr(t, "inductive predicates do not have an explicitly declared return type; it is always bool");
}
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
signatureEllipsis = t;
- } else SynErr(153);
- } else if (la.kind == 40) {
+ } else SynErr(159);
+ } else if (la.kind == 42) {
Get();
isCoPredicate = true;
- if (mmod.IsGhost) { SemErr(t, "copredicates cannot be declared 'ghost' (they are ghost by default)"); }
+ CheckDeclModifiers(dmod, "Copredicates",
+ AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static | AllowedDeclModifiers.Protected);
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 48 || la.kind == 50) {
- if (la.kind == 50) {
+ if (la.kind == 50 || la.kind == 52) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
Formals(true, isFunctionMethod, formals);
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
SemErr(t, "copredicates do not have an explicitly declared return type; it is always bool");
}
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
signatureEllipsis = t;
- } else SynErr(154);
- } else SynErr(155);
+ } else SynErr(160);
+ } else SynErr(161);
decreases = isIndPredicate || isCoPredicate ? null : new List<Expression/*!*/>();
- while (StartOf(9)) {
+ while (StartOf(11)) {
FunctionSpec(reqs, reads, ens, decreases);
}
- if (la.kind == 44) {
+ if (la.kind == 46) {
FunctionBody(out body, out bodyStart, out bodyEnd);
}
- if (DafnyOptions.O.DisallowSoundnessCheating && body == null && ens.Count > 0 && !Attributes.Contains(attrs, "axiom") && !Attributes.Contains(attrs, "imported")) {
+ if (!isWithinAbstractModule && DafnyOptions.O.DisallowSoundnessCheating && body == null && ens.Count > 0 &&
+ !Attributes.Contains(attrs, "axiom") && !Attributes.Contains(attrs, "imported")) {
SemErr(t, "a function with an ensures clause must have a body, unless given the :axiom attribute");
}
-
+ EncodeExternAsAttribute(dmod, ref attrs, id, /* needAxiom */ true);
IToken tok = theVerifyThisFile ? id : new IncludeToken(id);
if (isPredicate) {
- f = new Predicate(tok, id.val, mmod.IsStatic, mmod.IsProtected, !isFunctionMethod, typeArgs, formals,
+ f = new Predicate(tok, id.val, dmod.IsStatic, dmod.IsProtected, !isFunctionMethod, typeArgs, formals,
reqs, reads, ens, new Specification<Expression>(decreases, null), body, Predicate.BodyOriginKind.OriginalOrInherited, attrs, signatureEllipsis);
} else if (isIndPredicate) {
- f = new InductivePredicate(tok, id.val, mmod.IsStatic, mmod.IsProtected, typeArgs, formals,
+ f = new InductivePredicate(tok, id.val, dmod.IsStatic, dmod.IsProtected, typeArgs, formals,
reqs, reads, ens, body, attrs, signatureEllipsis);
} else if (isCoPredicate) {
- f = new CoPredicate(tok, id.val, mmod.IsStatic, mmod.IsProtected, typeArgs, formals,
+ f = new CoPredicate(tok, id.val, dmod.IsStatic, dmod.IsProtected, typeArgs, formals,
reqs, reads, ens, body, attrs, signatureEllipsis);
} else {
- f = new Function(tok, id.val, mmod.IsStatic, mmod.IsProtected, !isFunctionMethod, typeArgs, formals, returnType,
+ f = new Function(tok, id.val, dmod.IsStatic, dmod.IsProtected, !isFunctionMethod, typeArgs, formals, returnType,
reqs, reads, ens, new Specification<Expression>(decreases, null), body, attrs, signatureEllipsis);
}
f.BodyStartTok = bodyStart;
@@ -1259,7 +1475,7 @@ bool IsType(ref IToken pt) {
}
- void MethodDecl(MemberModifiers mmod, bool allowConstructor, out Method/*!*/ m) {
+ void MethodDecl(DeclModifierData dmod, bool allowConstructor, bool isWithinAbstractModule, out Method/*!*/ m) {
Contract.Ensures(Contract.ValueAtReturn(out m) !=null);
IToken/*!*/ id = Token.NoToken;
bool hasName = false; IToken keywordToken;
@@ -1281,71 +1497,65 @@ bool IsType(ref IToken pt) {
IToken signatureEllipsis = null;
IToken bodyStart = Token.NoToken;
IToken bodyEnd = Token.NoToken;
+ AllowedDeclModifiers allowed = AllowedDeclModifiers.None;
+ string caption = "";
- while (!(StartOf(10))) {SynErr(156); Get();}
+ while (!(StartOf(12))) {SynErr(162); Get();}
switch (la.kind) {
- case 81: {
+ case 87: {
Get();
+ caption = "Methods";
+ allowed = AllowedDeclModifiers.Ghost | AllowedDeclModifiers.Static
+ | AllowedDeclModifiers.Extern;
break;
}
- case 39: {
+ case 41: {
Get();
- isLemma = true;
+ isLemma = true; caption = "Lemmas";
+ allowed = AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static
+ | AllowedDeclModifiers.Protected;
break;
}
- case 82: {
+ case 88: {
Get();
- isCoLemma = true;
+ isCoLemma = true; caption = "Colemmas";
+ allowed = AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static
+ | AllowedDeclModifiers.Protected;
break;
}
- case 83: {
+ case 89: {
Get();
- isCoLemma = true;
+ isCoLemma = true; caption = "Comethods";
+ allowed = AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static
+ | AllowedDeclModifiers.Protected;
errors.Warning(t, "the 'comethod' keyword has been deprecated; it has been renamed to 'colemma'");
break;
}
- case 38: {
+ case 40: {
Get();
- Expect(39);
- isIndLemma = true;
+ Expect(41);
+ isIndLemma = true; caption = "Inductive lemmas";
+ allowed = AllowedDeclModifiers.AlreadyGhost | AllowedDeclModifiers.Static;
break;
}
- case 84: {
+ case 90: {
Get();
if (allowConstructor) {
isConstructor = true;
} else {
SemErr(t, "constructors are allowed only in classes");
- }
+ }
+ caption = "Constructors";
+ allowed = AllowedDeclModifiers.None;
break;
}
- default: SynErr(157); break;
+ default: SynErr(163); break;
}
keywordToken = t;
- if (isLemma) {
- if (mmod.IsGhost) {
- SemErr(t, "lemmas cannot be declared 'ghost' (they are automatically 'ghost')");
- }
- } else if (isConstructor) {
- if (mmod.IsGhost) {
- SemErr(t, "constructors cannot be declared 'ghost'");
- }
- if (mmod.IsStatic) {
- SemErr(t, "constructors cannot be declared 'static'");
- }
- } else if (isIndLemma) {
- if (mmod.IsGhost) {
- SemErr(t, "inductive lemmas cannot be declared 'ghost' (they are automatically 'ghost')");
- }
- } else if (isCoLemma) {
- if (mmod.IsGhost) {
- SemErr(t, "colemmas cannot be declared 'ghost' (they are automatically 'ghost')");
- }
- }
-
- while (la.kind == 44) {
+ CheckDeclModifiers(dmod, caption, allowed);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
if (la.kind == 1) {
@@ -1358,28 +1568,29 @@ bool IsType(ref IToken pt) {
SemErr(la, "a method must be given a name (expecting identifier)");
}
}
+ EncodeExternAsAttribute(dmod, ref attrs, id, /* needAxiom */ true);
- if (la.kind == 48 || la.kind == 50) {
- if (la.kind == 50) {
+ if (la.kind == 50 || la.kind == 52) {
+ if (la.kind == 52) {
GenericParameters(typeArgs);
}
- Formals(true, !mmod.IsGhost, ins);
- if (la.kind == 80) {
+ Formals(true, !dmod.IsGhost, ins);
+ if (la.kind == 86) {
Get();
if (isConstructor) { SemErr(t, "constructors cannot have out-parameters"); }
- Formals(false, !mmod.IsGhost, outs);
+ Formals(false, !dmod.IsGhost, outs);
}
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
signatureEllipsis = t;
- } else SynErr(158);
- while (StartOf(11)) {
+ } else SynErr(164);
+ while (StartOf(13)) {
MethodSpec(req, mod, ens, dec, ref decAttrs, ref modAttrs);
}
- if (la.kind == 44) {
+ if (la.kind == 46) {
BlockStmt(out body, out bodyStart, out bodyEnd);
}
- if (DafnyOptions.O.DisallowSoundnessCheating && body == null && ens.Count > 0 && !Attributes.Contains(attrs, "axiom") && !Attributes.Contains(attrs, "imported") && !Attributes.Contains(attrs, "decl") && theVerifyThisFile) {
+ if (!isWithinAbstractModule && DafnyOptions.O.DisallowSoundnessCheating && body == null && ens.Count > 0 && !Attributes.Contains(attrs, "axiom") && !Attributes.Contains(attrs, "imported") && !Attributes.Contains(attrs, "decl") && theVerifyThisFile) {
SemErr(t, "a method with an ensures clause must have a body, unless given the :axiom attribute");
}
@@ -1388,16 +1599,16 @@ bool IsType(ref IToken pt) {
m = new Constructor(tok, hasName ? id.val : "_ctor", typeArgs, ins,
req, new Specification<FrameExpression>(mod, modAttrs), ens, new Specification<Expression>(dec, decAttrs), body, attrs, signatureEllipsis);
} else if (isIndLemma) {
- m = new InductiveLemma(tok, id.val, mmod.IsStatic, typeArgs, ins, outs,
+ m = new InductiveLemma(tok, id.val, dmod.IsStatic, typeArgs, ins, outs,
req, new Specification<FrameExpression>(mod, modAttrs), ens, new Specification<Expression>(dec, decAttrs), body, attrs, signatureEllipsis);
} else if (isCoLemma) {
- m = new CoLemma(tok, id.val, mmod.IsStatic, typeArgs, ins, outs,
+ m = new CoLemma(tok, id.val, dmod.IsStatic, typeArgs, ins, outs,
req, new Specification<FrameExpression>(mod, modAttrs), ens, new Specification<Expression>(dec, decAttrs), body, attrs, signatureEllipsis);
} else if (isLemma) {
- m = new Lemma(tok, id.val, mmod.IsStatic, typeArgs, ins, outs,
+ m = new Lemma(tok, id.val, dmod.IsStatic, typeArgs, ins, outs,
req, new Specification<FrameExpression>(mod, modAttrs), ens, new Specification<Expression>(dec, decAttrs), body, attrs, signatureEllipsis);
} else {
- m = new Method(tok, id.val, mmod.IsStatic, mmod.IsGhost, typeArgs, ins, outs,
+ m = new Method(tok, id.val, dmod.IsStatic, dmod.IsGhost, typeArgs, ins, outs,
req, new Specification<FrameExpression>(mod, modAttrs), ens, new Specification<Expression>(dec, decAttrs), body, attrs, signatureEllipsis);
}
m.BodyStartTok = bodyStart;
@@ -1411,11 +1622,11 @@ bool IsType(ref IToken pt) {
IToken/*!*/ id;
List<Formal/*!*/> formals = new List<Formal/*!*/>();
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
NoUSIdent(out id);
- if (la.kind == 48) {
+ if (la.kind == 50) {
FormalsOptionalIds(formals);
}
ctors.Add(new DatatypeCtor(id, id.val, formals, attrs));
@@ -1423,17 +1634,17 @@ bool IsType(ref IToken pt) {
void FormalsOptionalIds(List<Formal/*!*/>/*!*/ formals) {
Contract.Requires(cce.NonNullElements(formals)); IToken/*!*/ id; Type/*!*/ ty; string/*!*/ name; bool isGhost;
- Expect(48);
- if (StartOf(12)) {
+ Expect(50);
+ if (StartOf(14)) {
TypeIdentOptional(out id, out name, out ty, out isGhost);
formals.Add(new Formal(id, name, ty, true, isGhost));
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
TypeIdentOptional(out id, out name, out ty, out isGhost);
formals.Add(new Formal(id, name, ty, true, isGhost));
}
}
- Expect(49);
+ Expect(51);
}
void FIdentType(out IToken/*!*/ id, out Type/*!*/ ty) {
@@ -1445,14 +1656,14 @@ bool IsType(ref IToken pt) {
} else if (la.kind == 2) {
Get();
id = t;
- } else SynErr(159);
- Expect(20);
+ } else SynErr(165);
+ Expect(21);
Type(out ty);
}
void OldSemi() {
- if (la.kind == 26) {
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(160); Get();}
+ if (la.kind == 28) {
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(166); Get();}
Get();
}
}
@@ -1461,7 +1672,7 @@ bool IsType(ref IToken pt) {
Expression e0; IToken endTok;
EquivExpression(out e, allowSemi, allowLambda);
if (SemiFollowsCall(allowSemi, e)) {
- Expect(26);
+ Expect(28);
endTok = t;
Expression(out e0, allowSemi, allowLambda);
e = new StmtExpr(e.tok,
@@ -1475,7 +1686,7 @@ bool IsType(ref IToken pt) {
Contract.Ensures(Contract.ValueAtReturn(out id)!=null);
Contract.Ensures(Contract.ValueAtReturn(out ty)!=null);
isGhost = false;
- if (la.kind == 70) {
+ if (la.kind == 62) {
Get();
if (allowGhostKeyword) { isGhost = true; } else { SemErr(t, "formal cannot be declared 'ghost' in this context"); }
}
@@ -1485,7 +1696,7 @@ bool IsType(ref IToken pt) {
void IdentType(out IToken/*!*/ id, out Type/*!*/ ty, bool allowWildcardId) {
Contract.Ensures(Contract.ValueAtReturn(out id) != null); Contract.Ensures(Contract.ValueAtReturn(out ty) != null);
WildIdent(out id, allowWildcardId);
- Expect(20);
+ Expect(21);
Type(out ty);
}
@@ -1501,7 +1712,7 @@ bool IsType(ref IToken pt) {
IToken id; Type ty; Type optType = null;
WildIdent(out id, true);
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
Type(out ty);
optType = ty;
@@ -1514,7 +1725,7 @@ bool IsType(ref IToken pt) {
IToken id; Type ty; Type optType = null;
WildIdent(out id, true);
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
Type(out ty);
optType = ty;
@@ -1527,13 +1738,13 @@ bool IsType(ref IToken pt) {
Contract.Ensures(Contract.ValueAtReturn(out ty)!=null);
Contract.Ensures(Contract.ValueAtReturn(out identName)!=null);
string name = null; id = Token.NoToken; ty = new BoolType()/*dummy*/; isGhost = false;
- if (la.kind == 70) {
+ if (la.kind == 62) {
Get();
isGhost = true;
}
- if (StartOf(3)) {
+ if (StartOf(5)) {
TypeAndToken(out id, out ty);
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
UserDefinedType udt = ty as UserDefinedType;
if (udt != null && udt.TypeArgs.Count == 0) {
@@ -1547,9 +1758,9 @@ bool IsType(ref IToken pt) {
} else if (la.kind == 2) {
Get();
id = t; name = id.val;
- Expect(20);
+ Expect(21);
Type(out ty);
- } else SynErr(161);
+ } else SynErr(167);
if (name != null) {
identName = name;
} else {
@@ -1597,20 +1808,33 @@ bool IsType(ref IToken pt) {
case 13: {
Get();
tok = t; gt = new List<Type>();
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericInstantiation(gt);
}
if (gt.Count > 1) {
SemErr("set type expects only one type argument");
}
- ty = new SetType(gt.Count == 1 ? gt[0] : null);
+ ty = new SetType(true, gt.Count == 1 ? gt[0] : null);
break;
}
case 14: {
Get();
tok = t; gt = new List<Type>();
- if (la.kind == 50) {
+ if (la.kind == 52) {
+ GenericInstantiation(gt);
+ }
+ if (gt.Count > 1) {
+ SemErr("set type expects only one type argument");
+ }
+ ty = new SetType(false, gt.Count == 1 ? gt[0] : null);
+
+ break;
+ }
+ case 15: {
+ Get();
+ tok = t; gt = new List<Type>();
+ if (la.kind == 52) {
GenericInstantiation(gt);
}
if (gt.Count > 1) {
@@ -1620,10 +1844,10 @@ bool IsType(ref IToken pt) {
break;
}
- case 15: {
+ case 16: {
Get();
tok = t; gt = new List<Type>();
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericInstantiation(gt);
}
if (gt.Count > 1) {
@@ -1638,10 +1862,10 @@ bool IsType(ref IToken pt) {
tok = t; ty = new UserDefinedType(tok, tok.val, null);
break;
}
- case 16: {
+ case 17: {
Get();
tok = t; gt = new List<Type>();
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericInstantiation(gt);
}
if (gt.Count == 0) {
@@ -1655,10 +1879,10 @@ bool IsType(ref IToken pt) {
break;
}
- case 17: {
+ case 18: {
Get();
tok = t; gt = new List<Type>();
- if (la.kind == 50) {
+ if (la.kind == 52) {
GenericInstantiation(gt);
}
if (gt.Count == 0) {
@@ -1675,7 +1899,7 @@ bool IsType(ref IToken pt) {
case 5: {
Get();
tok = t; gt = null;
- if (la.kind == 50) {
+ if (la.kind == 52) {
gt = new List<Type>();
GenericInstantiation(gt);
}
@@ -1684,19 +1908,19 @@ bool IsType(ref IToken pt) {
break;
}
- case 48: {
+ case 50: {
Get();
tok = t; tupleArgTypes = new List<Type>();
- if (StartOf(3)) {
+ if (StartOf(5)) {
Type(out ty);
tupleArgTypes.Add(ty);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Type(out ty);
tupleArgTypes.Add(ty);
}
}
- Expect(49);
+ Expect(51);
if (tupleArgTypes.Count == 1) {
// just return the type 'ty'
} else {
@@ -1711,11 +1935,11 @@ bool IsType(ref IToken pt) {
Expression e; tok = t;
NameSegmentForTypeName(out e);
tok = t;
- while (la.kind == 25) {
+ while (la.kind == 27) {
Get();
Expect(1);
tok = t; List<Type> typeArgs = null;
- if (la.kind == 50) {
+ if (la.kind == 52) {
typeArgs = new List<Type>();
GenericInstantiation(typeArgs);
}
@@ -1724,9 +1948,9 @@ bool IsType(ref IToken pt) {
ty = new UserDefinedType(e.tok, e);
break;
}
- default: SynErr(162); break;
+ default: SynErr(168); break;
}
- if (la.kind == 28) {
+ if (la.kind == 30) {
Type t2;
Get();
tok = t;
@@ -1744,17 +1968,17 @@ bool IsType(ref IToken pt) {
void Formals(bool incoming, bool allowGhostKeyword, List<Formal> formals) {
Contract.Requires(cce.NonNullElements(formals)); IToken id; Type ty; bool isGhost;
- Expect(48);
- if (la.kind == 1 || la.kind == 70) {
+ Expect(50);
+ if (la.kind == 1 || la.kind == 62) {
GIdentType(allowGhostKeyword, out id, out ty, out isGhost);
formals.Add(new Formal(id, id.val, ty, incoming, isGhost));
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
GIdentType(allowGhostKeyword, out id, out ty, out isGhost);
formals.Add(new Formal(id, id.val, ty, incoming, isGhost));
}
}
- Expect(49);
+ Expect(51);
}
void IteratorSpec(List<FrameExpression/*!*/>/*!*/ reads, List<FrameExpression/*!*/>/*!*/ mod, List<Expression/*!*/> decreases,
@@ -1763,45 +1987,45 @@ List<MaybeFreeExpression/*!*/>/*!*/ yieldReq, List<MaybeFreeExpression/*!*/>/*!*
ref Attributes readsAttrs, ref Attributes modAttrs, ref Attributes decrAttrs) {
Expression/*!*/ e; FrameExpression/*!*/ fe; bool isFree = false; bool isYield = false; Attributes ensAttrs = null;
- while (!(StartOf(13))) {SynErr(163); Get();}
- if (la.kind == 42) {
+ while (!(StartOf(15))) {SynErr(169); Get();}
+ if (la.kind == 44) {
Get();
while (IsAttribute()) {
Attribute(ref readsAttrs);
}
FrameExpression(out fe, false, false);
reads.Add(fe);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
FrameExpression(out fe, false, false);
reads.Add(fe);
}
OldSemi();
- } else if (la.kind == 41) {
+ } else if (la.kind == 43) {
Get();
while (IsAttribute()) {
Attribute(ref modAttrs);
}
FrameExpression(out fe, false, false);
mod.Add(fe);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
FrameExpression(out fe, false, false);
mod.Add(fe);
}
OldSemi();
- } else if (StartOf(14)) {
- if (la.kind == 85) {
+ } else if (StartOf(16)) {
+ if (la.kind == 91) {
Get();
isFree = true;
errors.Warning(t, "the 'free' keyword is soon to be deprecated");
}
- if (la.kind == 87) {
+ if (la.kind == 93) {
Get();
isYield = true;
}
- if (la.kind == 43) {
+ if (la.kind == 45) {
Get();
Expression(out e, false, false);
OldSemi();
@@ -1811,7 +2035,7 @@ ref Attributes readsAttrs, ref Attributes modAttrs, ref Attributes decrAttrs) {
req.Add(new MaybeFreeExpression(e, isFree));
}
- } else if (la.kind == 86) {
+ } else if (la.kind == 92) {
Get();
while (IsAttribute()) {
Attribute(ref ensAttrs);
@@ -1824,27 +2048,27 @@ ref Attributes readsAttrs, ref Attributes modAttrs, ref Attributes decrAttrs) {
ens.Add(new MaybeFreeExpression(e, isFree, ensAttrs));
}
- } else SynErr(164);
- } else if (la.kind == 34) {
+ } else SynErr(170);
+ } else if (la.kind == 36) {
Get();
while (IsAttribute()) {
Attribute(ref decrAttrs);
}
DecreasesList(decreases, false, false);
OldSemi();
- } else SynErr(165);
+ } else SynErr(171);
}
void BlockStmt(out BlockStmt/*!*/ block, out IToken bodyStart, out IToken bodyEnd) {
Contract.Ensures(Contract.ValueAtReturn(out block) != null);
List<Statement/*!*/> body = new List<Statement/*!*/>();
- Expect(44);
+ Expect(46);
bodyStart = t;
- while (StartOf(15)) {
+ while (StartOf(17)) {
Stmt(body);
}
- Expect(45);
+ Expect(47);
bodyEnd = t;
block = new BlockStmt(bodyStart, bodyEnd, body);
}
@@ -1854,33 +2078,33 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Contract.Requires(cce.NonNullElements(req)); Contract.Requires(cce.NonNullElements(mod)); Contract.Requires(cce.NonNullElements(ens)); Contract.Requires(cce.NonNullElements(decreases));
Expression/*!*/ e; FrameExpression/*!*/ fe; bool isFree = false; Attributes ensAttrs = null;
- while (!(StartOf(16))) {SynErr(166); Get();}
- if (la.kind == 41) {
+ while (!(StartOf(18))) {SynErr(172); Get();}
+ if (la.kind == 43) {
Get();
while (IsAttribute()) {
Attribute(ref modAttrs);
}
FrameExpression(out fe, false, false);
mod.Add(fe);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
FrameExpression(out fe, false, false);
mod.Add(fe);
}
OldSemi();
- } else if (la.kind == 43 || la.kind == 85 || la.kind == 86) {
- if (la.kind == 85) {
+ } else if (la.kind == 45 || la.kind == 91 || la.kind == 92) {
+ if (la.kind == 91) {
Get();
isFree = true;
errors.Warning(t, "the 'free' keyword is soon to be deprecated");
}
- if (la.kind == 43) {
+ if (la.kind == 45) {
Get();
Expression(out e, false, false);
OldSemi();
req.Add(new MaybeFreeExpression(e, isFree));
- } else if (la.kind == 86) {
+ } else if (la.kind == 92) {
Get();
while (IsAttribute()) {
Attribute(ref ensAttrs);
@@ -1888,15 +2112,15 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression(out e, false, false);
OldSemi();
ens.Add(new MaybeFreeExpression(e, isFree, ensAttrs));
- } else SynErr(167);
- } else if (la.kind == 34) {
+ } else SynErr(173);
+ } else if (la.kind == 36) {
Get();
while (IsAttribute()) {
Attribute(ref decAttrs);
}
DecreasesList(decreases, true, false);
OldSemi();
- } else SynErr(168);
+ } else SynErr(174);
}
void FrameExpression(out FrameExpression fe, bool allowSemi, bool allowLambda) {
@@ -1906,21 +2130,21 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
string fieldName = null; IToken feTok = null;
fe = null;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out e, allowSemi, allowLambda);
feTok = e.tok;
- if (la.kind == 88) {
+ if (la.kind == 94) {
Get();
Ident(out id);
fieldName = id.val; feTok = id;
}
fe = new FrameExpression(feTok, e, fieldName);
- } else if (la.kind == 88) {
+ } else if (la.kind == 94) {
Get();
Ident(out id);
fieldName = id.val;
fe = new FrameExpression(id, new ImplicitThisExpr(id), fieldName);
- } else SynErr(169);
+ } else SynErr(175);
}
void DecreasesList(List<Expression> decreases, bool allowWildcard, bool allowLambda) {
@@ -1932,7 +2156,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
decreases.Add(e);
}
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
PossiblyWildExpression(out e, allowLambda);
if (!allowWildcard && e is WildcardExpr) {
@@ -1946,15 +2170,15 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
void GenericInstantiation(List<Type/*!*/>/*!*/ gt) {
Contract.Requires(cce.NonNullElements(gt)); Type/*!*/ ty;
- Expect(50);
+ Expect(52);
Type(out ty);
gt.Add(ty);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Type(out ty);
gt.Add(ty);
}
- Expect(51);
+ Expect(53);
}
void NameSegmentForTypeName(out Expression e) {
@@ -1962,7 +2186,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
List<Type> typeArgs = null;
Ident(out id);
- if (la.kind == 50) {
+ if (la.kind == 52) {
typeArgs = new List<Type>();
GenericInstantiation(typeArgs);
}
@@ -1975,28 +2199,28 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Contract.Requires(cce.NonNullElements(reads));
Contract.Requires(decreases == null || cce.NonNullElements(decreases));
Expression/*!*/ e; FrameExpression/*!*/ fe;
- while (!(StartOf(17))) {SynErr(170); Get();}
- if (la.kind == 43) {
+ while (!(StartOf(19))) {SynErr(176); Get();}
+ if (la.kind == 45) {
Get();
Expression(out e, false, false);
OldSemi();
reqs.Add(e);
- } else if (la.kind == 42) {
+ } else if (la.kind == 44) {
Get();
PossiblyWildFrameExpression(out fe, false);
reads.Add(fe);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
PossiblyWildFrameExpression(out fe, false);
reads.Add(fe);
}
OldSemi();
- } else if (la.kind == 86) {
+ } else if (la.kind == 92) {
Get();
Expression(out e, false, false);
OldSemi();
ens.Add(e);
- } else if (la.kind == 34) {
+ } else if (la.kind == 36) {
Get();
if (decreases == null) {
SemErr(t, "'decreases' clauses are meaningless for copredicates, so they are not allowed");
@@ -2005,37 +2229,37 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
DecreasesList(decreases, false, false);
OldSemi();
- } else SynErr(171);
+ } else SynErr(177);
}
void FunctionBody(out Expression/*!*/ e, out IToken bodyStart, out IToken bodyEnd) {
Contract.Ensures(Contract.ValueAtReturn(out e) != null); e = dummyExpr;
- Expect(44);
+ Expect(46);
bodyStart = t;
Expression(out e, true, true);
- Expect(45);
+ Expect(47);
bodyEnd = t;
}
void PossiblyWildFrameExpression(out FrameExpression fe, bool allowSemi) {
Contract.Ensures(Contract.ValueAtReturn(out fe) != null); fe = dummyFrameExpr;
- if (la.kind == 55) {
+ if (la.kind == 57) {
Get();
fe = new FrameExpression(t, new WildcardExpr(t), null);
- } else if (StartOf(18)) {
+ } else if (StartOf(20)) {
FrameExpression(out fe, allowSemi, false);
- } else SynErr(172);
+ } else SynErr(178);
}
void PossiblyWildExpression(out Expression e, bool allowLambda) {
Contract.Ensures(Contract.ValueAtReturn(out e)!=null);
e = dummyExpr;
- if (la.kind == 55) {
+ if (la.kind == 57) {
Get();
e = new WildcardExpr(t);
- } else if (StartOf(7)) {
+ } else if (StartOf(9)) {
Expression(out e, false, allowLambda);
- } else SynErr(173);
+ } else SynErr(179);
}
void Stmt(List<Statement/*!*/>/*!*/ ss) {
@@ -2052,92 +2276,92 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken bodyStart, bodyEnd;
int breakCount;
- while (!(StartOf(19))) {SynErr(174); Get();}
+ while (!(StartOf(21))) {SynErr(180); Get();}
switch (la.kind) {
- case 44: {
+ case 46: {
BlockStmt(out bs, out bodyStart, out bodyEnd);
s = bs;
break;
}
- case 99: {
+ case 104: {
AssertStmt(out s);
break;
}
- case 29: {
+ case 31: {
AssumeStmt(out s);
break;
}
- case 100: {
+ case 105: {
PrintStmt(out s);
break;
}
- case 1: case 2: case 3: case 4: case 8: case 10: case 18: case 19: case 22: case 48: case 129: case 130: case 131: case 132: case 133: case 134: {
+ case 1: case 2: case 3: case 4: case 8: case 10: case 19: case 20: case 23: case 50: case 133: case 134: case 135: case 136: case 137: case 138: {
UpdateStmt(out s);
break;
}
- case 70: case 75: {
+ case 62: case 81: {
VarDeclStatement(out s);
break;
}
- case 96: {
+ case 101: {
IfStmt(out s);
break;
}
- case 97: {
+ case 102: {
WhileStmt(out s);
break;
}
- case 98: {
+ case 103: {
MatchStmt(out s);
break;
}
- case 101: case 102: {
+ case 106: case 107: {
ForallStmt(out s);
break;
}
- case 30: {
+ case 32: {
CalcStmt(out s);
break;
}
- case 103: {
+ case 108: {
ModifyStmt(out s);
break;
}
- case 89: {
+ case 95: {
Get();
x = t;
NoUSIdent(out id);
- Expect(20);
+ Expect(21);
OneStmt(out s);
s.Labels = new LList<Label>(new Label(x, id.val), s.Labels);
break;
}
- case 90: {
+ case 96: {
Get();
x = t; breakCount = 1; label = null;
if (la.kind == 1) {
NoUSIdent(out id);
label = id.val;
- } else if (la.kind == 26 || la.kind == 90) {
- while (la.kind == 90) {
+ } else if (la.kind == 28 || la.kind == 96) {
+ while (la.kind == 96) {
Get();
breakCount++;
}
- } else SynErr(175);
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(176); Get();}
- Expect(26);
+ } else SynErr(181);
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(182); Get();}
+ Expect(28);
s = label != null ? new BreakStmt(x, t, label) : new BreakStmt(x, t, breakCount);
break;
}
- case 87: case 93: {
+ case 93: case 99: {
ReturnStmt(out s);
break;
}
- case 57: {
+ case 59: {
SkeletonStmt(out s);
break;
}
- default: SynErr(177); break;
+ default: SynErr(183); break;
}
}
@@ -2146,18 +2370,18 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression e = dummyExpr; Attributes attrs = null;
IToken dotdotdot = null;
- Expect(99);
+ Expect(104);
x = t;
while (IsAttribute()) {
Attribute(ref attrs);
}
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out e, false, true);
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
dotdotdot = t;
- } else SynErr(178);
- Expect(26);
+ } else SynErr(184);
+ Expect(28);
if (dotdotdot != null) {
s = new SkeletonStatement(new AssertStmt(x, t, new LiteralExpr(x, true), attrs), dotdotdot, null);
} else {
@@ -2171,18 +2395,18 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression e = dummyExpr; Attributes attrs = null;
IToken dotdotdot = null;
- Expect(29);
+ Expect(31);
x = t;
while (IsAttribute()) {
Attribute(ref attrs);
}
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out e, false, true);
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
dotdotdot = t;
- } else SynErr(179);
- Expect(26);
+ } else SynErr(185);
+ Expect(28);
if (dotdotdot != null) {
s = new SkeletonStatement(new AssumeStmt(x, t, new LiteralExpr(x, true), attrs), dotdotdot, null);
} else {
@@ -2196,16 +2420,16 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken x; Expression e;
var args = new List<Expression>();
- Expect(100);
+ Expect(105);
x = t;
Expression(out e, false, true);
args.Add(e);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Expression(out e, false, true);
args.Add(e);
}
- Expect(26);
+ Expect(28);
s = new PrintStmt(x, t, args);
}
@@ -2220,44 +2444,44 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Lhs(out e);
x = e.tok;
- if (la.kind == 26 || la.kind == 44) {
- while (la.kind == 44) {
+ if (la.kind == 28 || la.kind == 46) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
- Expect(26);
+ Expect(28);
endTok = t; rhss.Add(new ExprRhs(e, attrs));
- } else if (la.kind == 21 || la.kind == 92 || la.kind == 94) {
+ } else if (la.kind == 22 || la.kind == 25 || la.kind == 98) {
lhss.Add(e);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Lhs(out e);
lhss.Add(e);
}
- if (la.kind == 92) {
+ if (la.kind == 98) {
Get();
x = t;
Rhs(out r);
rhss.Add(r);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Rhs(out r);
rhss.Add(r);
}
- } else if (la.kind == 94) {
+ } else if (la.kind == 25) {
Get();
x = t;
if (la.kind == _assume) {
- Expect(29);
+ Expect(31);
suchThatAssume = t;
}
Expression(out suchThat, false, true);
- } else SynErr(180);
- Expect(26);
+ } else SynErr(186);
+ Expect(28);
endTok = t;
- } else if (la.kind == 20) {
+ } else if (la.kind == 21) {
Get();
SemErr(t, "invalid statement (did you forget the 'label' keyword?)");
- } else SynErr(181);
+ } else SynErr(187);
if (suchThat != null) {
s = new AssignSuchThatStmt(x, endTok, lhss, suchThat, suchThatAssume, null);
} else {
@@ -2280,76 +2504,117 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression suchThat = null;
Attributes attrs = null;
IToken endTok;
+ s = dummyStmt;
- if (la.kind == 70) {
+ if (la.kind == 62) {
Get();
isGhost = true; x = t;
}
- Expect(75);
+ Expect(81);
if (!isGhost) { x = t; }
- while (la.kind == 44) {
- Attribute(ref attrs);
- }
- LocalIdentTypeOptional(out d, isGhost);
- lhss.Add(d); d.Attributes = attrs; attrs = null;
- while (la.kind == 21) {
- Get();
- while (la.kind == 44) {
+ if (la.kind == 1 || la.kind == 46) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
LocalIdentTypeOptional(out d, isGhost);
lhss.Add(d); d.Attributes = attrs; attrs = null;
- }
- if (la.kind == 44 || la.kind == 92 || la.kind == 94) {
- if (la.kind == 92) {
+ while (la.kind == 22) {
Get();
- assignTok = t;
- Rhs(out r);
- rhss.Add(r);
- while (la.kind == 21) {
+ while (la.kind == 46) {
+ Attribute(ref attrs);
+ }
+ LocalIdentTypeOptional(out d, isGhost);
+ lhss.Add(d); d.Attributes = attrs; attrs = null;
+ }
+ if (la.kind == 25 || la.kind == 46 || la.kind == 98) {
+ if (la.kind == 98) {
Get();
+ assignTok = t;
Rhs(out r);
rhss.Add(r);
+ while (la.kind == 22) {
+ Get();
+ Rhs(out r);
+ rhss.Add(r);
+ }
+ } else {
+ while (la.kind == 46) {
+ Attribute(ref attrs);
+ }
+ Expect(25);
+ assignTok = t;
+ if (la.kind == _assume) {
+ Expect(31);
+ suchThatAssume = t;
+ }
+ Expression(out suchThat, false, true);
}
+ }
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(188); Get();}
+ Expect(28);
+ endTok = t;
+ ConcreteUpdateStatement update;
+ if (suchThat != null) {
+ var ies = new List<Expression>();
+ foreach (var lhs in lhss) {
+ ies.Add(new IdentifierExpr(lhs.Tok, lhs.Name));
+ }
+ update = new AssignSuchThatStmt(assignTok, endTok, ies, suchThat, suchThatAssume, attrs);
+ } else if (rhss.Count == 0) {
+ update = null;
} else {
- while (la.kind == 44) {
- Attribute(ref attrs);
- }
- Expect(94);
- assignTok = t;
- if (la.kind == _assume) {
- Expect(29);
- suchThatAssume = t;
+ var ies = new List<Expression>();
+ foreach (var lhs in lhss) {
+ ies.Add(new AutoGhostIdentifierExpr(lhs.Tok, lhs.Name));
+ }
+ update = new UpdateStmt(assignTok, endTok, ies, rhss);
+ }
+ s = new VarDeclStmt(x, endTok, lhss, update);
+
+ } else if (la.kind == 50) {
+ Get();
+ var letLHSs = new List<CasePattern>();
+ var letRHSs = new List<Expression>();
+ List<CasePattern> arguments = new List<CasePattern>();
+ CasePattern pat;
+ Expression e = dummyExpr;
+ IToken id = t;
+
+ if (la.kind == 1 || la.kind == 50) {
+ CasePattern(out pat);
+ arguments.Add(pat);
+ while (la.kind == 22) {
+ Get();
+ CasePattern(out pat);
+ arguments.Add(pat);
}
- Expression(out suchThat, false, true);
}
- }
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(182); Get();}
- Expect(26);
- endTok = t;
- ConcreteUpdateStatement update;
- if (suchThat != null) {
- var ies = new List<Expression>();
- foreach (var lhs in lhss) {
- ies.Add(new IdentifierExpr(lhs.Tok, lhs.Name));
- }
- update = new AssignSuchThatStmt(assignTok, endTok, ies, suchThat, suchThatAssume, attrs);
- } else if (rhss.Count == 0) {
- update = null;
- } else {
- var ies = new List<Expression>();
- foreach (var lhs in lhss) {
- ies.Add(new AutoGhostIdentifierExpr(lhs.Tok, lhs.Name));
- }
- update = new UpdateStmt(assignTok, endTok, ies, rhss);
- }
- s = new VarDeclStmt(x, endTok, lhss, update);
-
+ Expect(51);
+ theBuiltIns.TupleType(id, arguments.Count, true); // make sure the tuple type exists
+ string ctor = BuiltIns.TupleTypeCtorName; //use the TupleTypeCtors
+ pat = new CasePattern(id, ctor, arguments);
+ if (isGhost) { pat.Vars.Iter(bv => bv.IsGhost = true); }
+ letLHSs.Add(pat);
+
+ if (la.kind == 98) {
+ Get();
+ } else if (la.kind == 25 || la.kind == 46) {
+ while (la.kind == 46) {
+ Attribute(ref attrs);
+ }
+ Expect(25);
+ SemErr(pat.tok, "LHS of assign-such-that expression must be variables, not general patterns");
+ } else SynErr(189);
+ Expression(out e, false, true);
+ letRHSs.Add(e);
+ Expect(28);
+ s = new LetStmt(e.tok, e.tok, letLHSs, letRHSs);
+ } else SynErr(190);
}
void IfStmt(out Statement/*!*/ ifStmt) {
Contract.Ensures(Contract.ValueAtReturn(out ifStmt) != null); IToken/*!*/ x;
- Expression guard = null; IToken guardEllipsis = null;
+ Expression guard = null; IToken guardEllipsis = null; bool isExistentialGuard = false;
BlockStmt/*!*/ thn;
BlockStmt/*!*/ bs;
Statement/*!*/ s;
@@ -2358,13 +2623,16 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
List<GuardedAlternative> alternatives;
ifStmt = dummyStmt; // to please the compiler
- Expect(96);
+ Expect(101);
x = t;
if (IsAlternative()) {
- AlternativeBlock(out alternatives, out endTok);
+ AlternativeBlock(true, out alternatives, out endTok);
ifStmt = new AlternativeStmt(x, endTok, alternatives);
- } else if (StartOf(20)) {
- if (StartOf(21)) {
+ } else if (StartOf(22)) {
+ if (IsExistentialGuard()) {
+ ExistentialGuard(out guard, true);
+ isExistentialGuard = true;
+ } else if (StartOf(23)) {
Guard(out guard);
} else {
Get();
@@ -2372,23 +2640,23 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
BlockStmt(out thn, out bodyStart, out bodyEnd);
endTok = thn.EndTok;
- if (la.kind == 33) {
+ if (la.kind == 35) {
Get();
- if (la.kind == 96) {
+ if (la.kind == 101) {
IfStmt(out s);
els = s; endTok = s.EndTok;
- } else if (la.kind == 44) {
+ } else if (la.kind == 46) {
BlockStmt(out bs, out bodyStart, out bodyEnd);
els = bs; endTok = bs.EndTok;
- } else SynErr(183);
+ } else SynErr(191);
}
if (guardEllipsis != null) {
- ifStmt = new SkeletonStatement(new IfStmt(x, endTok, guard, thn, els), guardEllipsis, null);
+ ifStmt = new SkeletonStatement(new IfStmt(x, endTok, isExistentialGuard, guard, thn, els), guardEllipsis, null);
} else {
- ifStmt = new IfStmt(x, endTok, guard, thn, els);
+ ifStmt = new IfStmt(x, endTok, isExistentialGuard, guard, thn, els);
}
- } else SynErr(184);
+ } else SynErr(192);
}
void WhileStmt(out Statement stmt) {
@@ -2407,33 +2675,33 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
stmt = dummyStmt; // to please the compiler
bool isDirtyLoop = true;
- Expect(97);
+ Expect(102);
x = t;
if (IsLoopSpec() || IsAlternative()) {
- while (StartOf(22)) {
+ while (StartOf(24)) {
LoopSpec(invariants, decreases, ref mod, ref decAttrs, ref modAttrs);
}
- AlternativeBlock(out alternatives, out endTok);
+ AlternativeBlock(false, out alternatives, out endTok);
stmt = new AlternativeLoopStmt(x, endTok, invariants, new Specification<Expression>(decreases, decAttrs), new Specification<FrameExpression>(mod, modAttrs), alternatives);
- } else if (StartOf(20)) {
- if (StartOf(21)) {
+ } else if (StartOf(22)) {
+ if (StartOf(23)) {
Guard(out guard);
Contract.Assume(guard == null || cce.Owner.None(guard));
} else {
Get();
guardEllipsis = t;
}
- while (StartOf(22)) {
+ while (StartOf(24)) {
LoopSpec(invariants, decreases, ref mod, ref decAttrs, ref modAttrs);
}
if (la.kind == _lbrace) {
BlockStmt(out body, out bodyStart, out bodyEnd);
endTok = body.EndTok; isDirtyLoop = false;
} else if (la.kind == _ellipsis) {
- Expect(57);
+ Expect(59);
bodyEllipsis = t; endTok = t; isDirtyLoop = false;
- } else if (StartOf(23)) {
- } else SynErr(185);
+ } else if (StartOf(25)) {
+ } else SynErr(193);
if (guardEllipsis != null || bodyEllipsis != null) {
if (mod != null) {
SemErr(mod[0].E.tok, "'modifies' clauses are not allowed on refining loops");
@@ -2451,7 +2719,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
stmt = new WhileStmt(x, endTok, guard, invariants, new Specification<Expression>(decreases, decAttrs), new Specification<FrameExpression>(mod, modAttrs), body);
}
- } else SynErr(186);
+ } else SynErr(194);
}
void MatchStmt(out Statement/*!*/ s) {
@@ -2460,23 +2728,23 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
List<MatchCaseStmt/*!*/> cases = new List<MatchCaseStmt/*!*/>();
bool usesOptionalBrace = false;
- Expect(98);
+ Expect(103);
x = t;
Expression(out e, true, true);
if (la.kind == _lbrace) {
- Expect(44);
+ Expect(46);
usesOptionalBrace = true;
- while (la.kind == 31) {
+ while (la.kind == 33) {
CaseStatement(out c);
cases.Add(c);
}
- Expect(45);
- } else if (StartOf(23)) {
+ Expect(47);
+ } else if (StartOf(25)) {
while (la.kind == _case) {
CaseStatement(out c);
cases.Add(c);
}
- } else SynErr(187);
+ } else SynErr(195);
s = new MatchStmt(x, t, e, cases, usesOptionalBrace);
}
@@ -2493,38 +2761,38 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken bodyStart, bodyEnd;
IToken tok = Token.NoToken;
- if (la.kind == 101) {
+ if (la.kind == 106) {
Get();
x = t; tok = x;
- } else if (la.kind == 102) {
+ } else if (la.kind == 107) {
Get();
x = t;
errors.Warning(t, "the 'parallel' keyword has been deprecated; the comprehension statement now uses the keyword 'forall' (and the parentheses around the bound variables are now optional)");
- } else SynErr(188);
+ } else SynErr(196);
if (la.kind == _openparen) {
- Expect(48);
+ Expect(50);
if (la.kind == 1) {
QuantifierDomain(out bvars, out attrs, out range);
}
- Expect(49);
- } else if (StartOf(24)) {
+ Expect(51);
+ } else if (StartOf(26)) {
if (la.kind == _ident) {
QuantifierDomain(out bvars, out attrs, out range);
}
- } else SynErr(189);
+ } else SynErr(197);
if (bvars == null) { bvars = new List<BoundVar>(); }
if (range == null) { range = new LiteralExpr(x, true); }
- while (la.kind == 85 || la.kind == 86) {
+ while (la.kind == 91 || la.kind == 92) {
isFree = false;
- if (la.kind == 85) {
+ if (la.kind == 91) {
Get();
isFree = true;
errors.Warning(t, "the 'free' keyword is soon to be deprecated");
}
- Expect(86);
+ Expect(92);
Expression(out e, false, true);
ens.Add(new MaybeFreeExpression(e, isFree));
OldSemi();
@@ -2547,6 +2815,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
void CalcStmt(out Statement s) {
Contract.Ensures(Contract.ValueAtReturn(out s) != null);
Token x;
+ Attributes attrs = null;
CalcStmt.CalcOp op, calcOp = Microsoft.Dafny.CalcStmt.DefaultOp, resOp = Microsoft.Dafny.CalcStmt.DefaultOp;
var lines = new List<Expression>();
var hints = new List<BlockStmt>();
@@ -2557,9 +2826,12 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken opTok;
IToken danglingOperator = null;
- Expect(30);
+ Expect(32);
x = t;
- if (StartOf(25)) {
+ while (IsAttribute()) {
+ Attribute(ref attrs);
+ }
+ if (StartOf(27)) {
CalcOp(out opTok, out calcOp);
maybeOp = calcOp.ResultOp(calcOp); // guard against non-transitive calcOp (like !=)
if (maybeOp == null) {
@@ -2568,12 +2840,12 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
resOp = calcOp;
}
- Expect(44);
- while (StartOf(7)) {
+ Expect(46);
+ while (StartOf(9)) {
Expression(out e, false, true);
lines.Add(e); stepOp = calcOp; danglingOperator = null;
- Expect(26);
- if (StartOf(25)) {
+ Expect(28);
+ if (StartOf(27)) {
CalcOp(out opTok, out op);
maybeOp = resOp.ResultOp(op);
if (maybeOp == null) {
@@ -2592,20 +2864,20 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
BlockStmt subBlock; Statement subCalc;
while (la.kind == _lbrace || la.kind == _calc) {
- if (la.kind == 44) {
+ if (la.kind == 46) {
BlockStmt(out subBlock, out t0, out t1);
hintEnd = subBlock.EndTok; subhints.Add(subBlock);
- } else if (la.kind == 30) {
+ } else if (la.kind == 32) {
CalcStmt(out subCalc);
hintEnd = subCalc.EndTok; subhints.Add(subCalc);
- } else SynErr(190);
+ } else SynErr(198);
}
var h = new BlockStmt(hintStart, hintEnd, subhints); // if the hint is empty, hintStart is the first token of the next line, but it doesn't matter because the block statement is just used as a container
hints.Add(h);
if (h.Body.Count != 0) { danglingOperator = null; }
}
- Expect(45);
+ Expect(47);
if (danglingOperator != null) {
SemErr(danglingOperator, "a calculation cannot end with an operator");
}
@@ -2613,7 +2885,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
// Repeat the last line to create a dummy line for the dangling hint
lines.Add(lines[lines.Count - 1]);
}
- s = new CalcStmt(x, t, calcOp, lines, hints, stepOps, resOp);
+ s = new CalcStmt(x, t, calcOp, lines, hints, stepOps, resOp, attrs);
}
@@ -2624,30 +2896,30 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
BlockStmt body = null; IToken bodyStart;
IToken ellipsisToken = null;
- Expect(103);
+ Expect(108);
tok = t;
while (IsAttribute()) {
Attribute(ref attrs);
}
- if (StartOf(18)) {
+ if (StartOf(20)) {
FrameExpression(out fe, false, true);
mod.Add(fe);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
FrameExpression(out fe, false, true);
mod.Add(fe);
}
- } else if (la.kind == 57) {
+ } else if (la.kind == 59) {
Get();
ellipsisToken = t;
- } else SynErr(191);
- if (la.kind == 44) {
+ } else SynErr(199);
+ if (la.kind == 46) {
BlockStmt(out body, out bodyStart, out endTok);
- } else if (la.kind == 26) {
- while (!(la.kind == 0 || la.kind == 26)) {SynErr(192); Get();}
+ } else if (la.kind == 28) {
+ while (!(la.kind == 0 || la.kind == 28)) {SynErr(200); Get();}
Get();
endTok = t;
- } else SynErr(193);
+ } else SynErr(201);
s = new ModifyStmt(tok, endTok, mod, attrs, body);
if (ellipsisToken != null) {
s = new SkeletonStatement(s, ellipsisToken, null);
@@ -2661,23 +2933,23 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
AssignmentRhs r;
bool isYield = false;
- if (la.kind == 93) {
+ if (la.kind == 99) {
Get();
returnTok = t;
- } else if (la.kind == 87) {
+ } else if (la.kind == 93) {
Get();
returnTok = t; isYield = true;
- } else SynErr(194);
- if (StartOf(26)) {
+ } else SynErr(202);
+ if (StartOf(28)) {
Rhs(out r);
rhss = new List<AssignmentRhs>(); rhss.Add(r);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Rhs(out r);
rhss.Add(r);
}
}
- Expect(26);
+ Expect(28);
if (isYield) {
s = new YieldStmt(returnTok, t, rhss);
} else {
@@ -2691,22 +2963,22 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
List<Expression> exprs = null;
IToken tok, dotdotdot, whereTok;
Expression e;
- Expect(57);
+ Expect(59);
dotdotdot = t;
- if (la.kind == 91) {
+ if (la.kind == 97) {
Get();
names = new List<IToken>(); exprs = new List<Expression>(); whereTok = t;
Ident(out tok);
names.Add(tok);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Ident(out tok);
names.Add(tok);
}
- Expect(92);
+ Expect(98);
Expression(out e, false, true);
exprs.Add(e);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Expression(out e, false, true);
exprs.Add(e);
@@ -2717,7 +2989,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
}
- Expect(26);
+ Expect(28);
s = new SkeletonStatement(dotdotdot, t, names, exprs);
}
@@ -2730,25 +3002,25 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
r = dummyRhs; // to please compiler
Attributes attrs = null;
- if (la.kind == 95) {
+ if (la.kind == 100) {
Get();
newToken = t;
TypeAndToken(out x, out ty);
- if (la.kind == 46 || la.kind == 48) {
- if (la.kind == 46) {
+ if (la.kind == 48 || la.kind == 50) {
+ if (la.kind == 48) {
Get();
ee = new List<Expression>();
Expressions(ee);
- Expect(47);
+ Expect(49);
var tmp = theBuiltIns.ArrayType(ee.Count, new IntType(), true);
} else {
x = null; args = new List<Expression/*!*/>();
Get();
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(args);
}
- Expect(49);
+ Expect(51);
}
}
if (ee != null) {
@@ -2759,14 +3031,14 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
r = new TypeRhs(newToken, ty);
}
- } else if (la.kind == 55) {
+ } else if (la.kind == 57) {
Get();
r = new HavocRhs(t);
- } else if (StartOf(7)) {
+ } else if (StartOf(9)) {
Expression(out e, false, true);
r = new ExprRhs(e);
- } else SynErr(195);
- while (la.kind == 44) {
+ } else SynErr(203);
+ while (la.kind == 46) {
Attribute(ref attrs);
}
r.Attributes = attrs;
@@ -2777,94 +3049,170 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
if (la.kind == 1) {
NameSegment(out e);
- while (la.kind == 25 || la.kind == 46 || la.kind == 48) {
+ while (la.kind == 27 || la.kind == 48 || la.kind == 50) {
Suffix(ref e);
}
- } else if (StartOf(27)) {
+ } else if (StartOf(29)) {
ConstAtomExpression(out e, false, false);
Suffix(ref e);
- while (la.kind == 25 || la.kind == 46 || la.kind == 48) {
+ while (la.kind == 27 || la.kind == 48 || la.kind == 50) {
Suffix(ref e);
}
- } else SynErr(196);
+ } else SynErr(204);
}
void Expressions(List<Expression> args) {
Expression e;
Expression(out e, true, true);
args.Add(e);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Expression(out e, true, true);
args.Add(e);
}
}
- void AlternativeBlock(out List<GuardedAlternative> alternatives, out IToken endTok) {
+ void CasePattern(out CasePattern pat) {
+ IToken id; List<CasePattern> arguments;
+ BoundVar bv;
+ pat = null;
+
+ if (IsIdentParen()) {
+ Ident(out id);
+ Expect(50);
+ arguments = new List<CasePattern>();
+ if (la.kind == 1 || la.kind == 50) {
+ CasePattern(out pat);
+ arguments.Add(pat);
+ while (la.kind == 22) {
+ Get();
+ CasePattern(out pat);
+ arguments.Add(pat);
+ }
+ }
+ Expect(51);
+ pat = new CasePattern(id, id.val, arguments);
+ } else if (la.kind == 50) {
+ Get();
+ id = t;
+ arguments = new List<CasePattern>();
+
+ if (la.kind == 1 || la.kind == 50) {
+ CasePattern(out pat);
+ arguments.Add(pat);
+ while (la.kind == 22) {
+ Get();
+ CasePattern(out pat);
+ arguments.Add(pat);
+ }
+ }
+ Expect(51);
+ theBuiltIns.TupleType(id, arguments.Count, true); // make sure the tuple type exists
+ string ctor = BuiltIns.TupleTypeCtorName; //use the TupleTypeCtors
+ pat = new CasePattern(id, ctor, arguments);
+
+ } else if (la.kind == 1) {
+ IdentTypeOptional(out bv);
+ pat = new CasePattern(bv.tok, bv);
+
+ } else SynErr(205);
+ if (pat == null) {
+ pat = new CasePattern(t, "_ParseError", new List<CasePattern>());
+ }
+
+ }
+
+ void AlternativeBlock(bool allowExistentialGuards, out List<GuardedAlternative> alternatives, out IToken endTok) {
alternatives = new List<GuardedAlternative>();
IToken x;
- Expression e;
+ Expression e; bool isExistentialGuard;
List<Statement> body;
- Expect(44);
- while (la.kind == 31) {
- Get();
- x = t;
- Expression(out e, true, false);
- Expect(27);
+ Expect(46);
+ while (la.kind == 33) {
+ Get();
+ x = t; isExistentialGuard = false; e = dummyExpr;
+ if (allowExistentialGuards && IsExistentialGuard()) {
+ ExistentialGuard(out e, false );
+ isExistentialGuard = true;
+ } else if (StartOf(9)) {
+ Expression(out e, true, false);
+ } else SynErr(206);
+ Expect(29);
body = new List<Statement>();
- while (StartOf(15)) {
+ while (StartOf(17)) {
Stmt(body);
}
- alternatives.Add(new GuardedAlternative(x, e, body));
+ alternatives.Add(new GuardedAlternative(x, isExistentialGuard, e, body));
}
- Expect(45);
+ Expect(47);
endTok = t;
}
+ void ExistentialGuard(out Expression e, bool allowLambda) {
+ var bvars = new List<BoundVar>();
+ BoundVar bv; IToken x;
+ Attributes attrs = null;
+ Expression body;
+
+ IdentTypeOptional(out bv);
+ bvars.Add(bv); x = bv.tok;
+ while (la.kind == 22) {
+ Get();
+ IdentTypeOptional(out bv);
+ bvars.Add(bv);
+ }
+ while (la.kind == 46) {
+ Attribute(ref attrs);
+ }
+ Expect(25);
+ Expression(out body, true, allowLambda);
+ e = new ExistsExpr(x, bvars, null, body, attrs);
+ }
+
void Guard(out Expression e) {
Expression/*!*/ ee; e = null;
- if (la.kind == 55) {
+ if (la.kind == 57) {
Get();
e = null;
} else if (IsParenStar()) {
- Expect(48);
- Expect(55);
- Expect(49);
+ Expect(50);
+ Expect(57);
+ Expect(51);
e = null;
- } else if (StartOf(7)) {
+ } else if (StartOf(9)) {
Expression(out ee, true, true);
e = ee;
- } else SynErr(197);
+ } else SynErr(207);
}
void LoopSpec(List<MaybeFreeExpression> invariants, List<Expression> decreases, ref List<FrameExpression> mod, ref Attributes decAttrs, ref Attributes modAttrs) {
Expression e; FrameExpression fe;
bool isFree = false; Attributes attrs = null;
- if (la.kind == 35 || la.kind == 85) {
- while (!(la.kind == 0 || la.kind == 35 || la.kind == 85)) {SynErr(198); Get();}
- if (la.kind == 85) {
+ if (la.kind == 37 || la.kind == 91) {
+ while (!(la.kind == 0 || la.kind == 37 || la.kind == 91)) {SynErr(208); Get();}
+ if (la.kind == 91) {
Get();
isFree = true; errors.Warning(t, "the 'free' keyword is soon to be deprecated");
}
- Expect(35);
+ Expect(37);
while (IsAttribute()) {
Attribute(ref attrs);
}
Expression(out e, false, true);
invariants.Add(new MaybeFreeExpression(e, isFree, attrs));
OldSemi();
- } else if (la.kind == 34) {
- while (!(la.kind == 0 || la.kind == 34)) {SynErr(199); Get();}
+ } else if (la.kind == 36) {
+ while (!(la.kind == 0 || la.kind == 36)) {SynErr(209); Get();}
Get();
while (IsAttribute()) {
Attribute(ref decAttrs);
}
DecreasesList(decreases, true, true);
OldSemi();
- } else if (la.kind == 41) {
- while (!(la.kind == 0 || la.kind == 41)) {SynErr(200); Get();}
+ } else if (la.kind == 43) {
+ while (!(la.kind == 0 || la.kind == 43)) {SynErr(210); Get();}
Get();
mod = mod ?? new List<FrameExpression>();
while (IsAttribute()) {
@@ -2872,43 +3220,59 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
FrameExpression(out fe, false, true);
mod.Add(fe);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
FrameExpression(out fe, false, true);
mod.Add(fe);
}
OldSemi();
- } else SynErr(201);
+ } else SynErr(211);
}
void CaseStatement(out MatchCaseStmt/*!*/ c) {
Contract.Ensures(Contract.ValueAtReturn(out c) != null);
IToken/*!*/ x, id;
- List<BoundVar/*!*/> arguments = new List<BoundVar/*!*/>();
- BoundVar/*!*/ bv;
+ List<CasePattern/*!*/> arguments = new List<CasePattern/*!*/>();
+ CasePattern/*!*/ pat;
List<Statement/*!*/> body = new List<Statement/*!*/>();
+ string/*!*/ name = "";
- Expect(31);
+ Expect(33);
x = t;
- Ident(out id);
- if (la.kind == 48) {
+ if (la.kind == 1) {
+ Ident(out id);
+ name = id.val;
+ if (la.kind == 50) {
+ Get();
+ if (la.kind == 1 || la.kind == 50) {
+ CasePattern(out pat);
+ arguments.Add(pat);
+ while (la.kind == 22) {
+ Get();
+ CasePattern(out pat);
+ arguments.Add(pat);
+ }
+ }
+ Expect(51);
+ }
+ } else if (la.kind == 50) {
Get();
- IdentTypeOptional(out bv);
- arguments.Add(bv);
- while (la.kind == 21) {
+ CasePattern(out pat);
+ arguments.Add(pat);
+ while (la.kind == 22) {
Get();
- IdentTypeOptional(out bv);
- arguments.Add(bv);
+ CasePattern(out pat);
+ arguments.Add(pat);
}
- Expect(49);
- }
- Expect(27);
- while (!(StartOf(28))) {SynErr(202); Get();}
+ Expect(51);
+ } else SynErr(212);
+ Expect(29);
+ while (!(StartOf(30))) {SynErr(213); Get();}
while (IsNotEndOfCase()) {
Stmt(body);
- while (!(StartOf(28))) {SynErr(203); Get();}
+ while (!(StartOf(30))) {SynErr(214); Get();}
}
- c = new MatchCaseStmt(x, id.val, arguments, body);
+ c = new MatchCaseStmt(x, name, arguments, body);
}
void QuantifierDomain(out List<BoundVar> bvars, out Attributes attrs, out Expression range) {
@@ -2919,7 +3283,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IdentTypeOptional(out bv);
bvars.Add(bv);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
IdentTypeOptional(out bv);
bvars.Add(bv);
@@ -2928,7 +3292,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Attribute(ref attrs);
}
if (la.kind == _verticalbar) {
- Expect(22);
+ Expect(23);
Expression(out range, true, true);
}
}
@@ -2939,73 +3303,73 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
x = null;
switch (la.kind) {
- case 52: {
+ case 54: {
Get();
x = t; binOp = BinaryExpr.Opcode.Eq;
- if (la.kind == 104) {
+ if (la.kind == 109) {
Get();
- Expect(46);
+ Expect(48);
Expression(out k, true, true);
- Expect(47);
+ Expect(49);
}
break;
}
- case 50: {
+ case 52: {
Get();
x = t; binOp = BinaryExpr.Opcode.Lt;
break;
}
- case 51: {
+ case 53: {
Get();
x = t; binOp = BinaryExpr.Opcode.Gt;
break;
}
- case 105: {
+ case 110: {
Get();
x = t; binOp = BinaryExpr.Opcode.Le;
break;
}
- case 106: {
+ case 111: {
Get();
x = t; binOp = BinaryExpr.Opcode.Ge;
break;
}
- case 53: {
+ case 55: {
Get();
x = t; binOp = BinaryExpr.Opcode.Neq;
break;
}
- case 54: {
+ case 56: {
Get();
x = t; binOp = BinaryExpr.Opcode.Neq;
break;
}
- case 107: {
+ case 112: {
Get();
x = t; binOp = BinaryExpr.Opcode.Le;
break;
}
- case 108: {
+ case 113: {
Get();
x = t; binOp = BinaryExpr.Opcode.Ge;
break;
}
- case 109: case 110: {
+ case 114: case 115: {
EquivOp();
x = t; binOp = BinaryExpr.Opcode.Iff;
break;
}
- case 111: case 112: {
+ case 116: case 117: {
ImpliesOp();
x = t; binOp = BinaryExpr.Opcode.Imp;
break;
}
- case 113: case 114: {
+ case 118: case 119: {
ExpliesOp();
x = t; binOp = BinaryExpr.Opcode.Exp;
break;
}
- default: SynErr(204); break;
+ default: SynErr(215); break;
}
if (k == null) {
op = new Microsoft.Dafny.CalcStmt.BinaryCalcOp(binOp);
@@ -3016,75 +3380,75 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
void EquivOp() {
- if (la.kind == 109) {
+ if (la.kind == 114) {
Get();
- } else if (la.kind == 110) {
+ } else if (la.kind == 115) {
Get();
- } else SynErr(205);
+ } else SynErr(216);
}
void ImpliesOp() {
- if (la.kind == 111) {
+ if (la.kind == 116) {
Get();
- } else if (la.kind == 112) {
+ } else if (la.kind == 117) {
Get();
- } else SynErr(206);
+ } else SynErr(217);
}
void ExpliesOp() {
- if (la.kind == 113) {
+ if (la.kind == 118) {
Get();
- } else if (la.kind == 114) {
+ } else if (la.kind == 119) {
Get();
- } else SynErr(207);
+ } else SynErr(218);
}
void AndOp() {
- if (la.kind == 115) {
+ if (la.kind == 120) {
Get();
- } else if (la.kind == 116) {
+ } else if (la.kind == 121) {
Get();
- } else SynErr(208);
+ } else SynErr(219);
}
void OrOp() {
- if (la.kind == 117) {
+ if (la.kind == 122) {
Get();
- } else if (la.kind == 118) {
+ } else if (la.kind == 123) {
Get();
- } else SynErr(209);
+ } else SynErr(220);
}
void NegOp() {
- if (la.kind == 119) {
+ if (la.kind == 124) {
Get();
- } else if (la.kind == 120) {
+ } else if (la.kind == 125) {
Get();
- } else SynErr(210);
+ } else SynErr(221);
}
void Forall() {
- if (la.kind == 101) {
+ if (la.kind == 106) {
Get();
- } else if (la.kind == 121) {
+ } else if (la.kind == 126) {
Get();
- } else SynErr(211);
+ } else SynErr(222);
}
void Exists() {
- if (la.kind == 122) {
+ if (la.kind == 127) {
Get();
- } else if (la.kind == 123) {
+ } else if (la.kind == 128) {
Get();
- } else SynErr(212);
+ } else SynErr(223);
}
void QSep() {
- if (la.kind == 23) {
+ if (la.kind == 24) {
Get();
- } else if (la.kind == 24) {
+ } else if (la.kind == 26) {
Get();
- } else SynErr(213);
+ } else SynErr(224);
}
void EquivExpression(out Expression e0, bool allowSemi, bool allowLambda) {
@@ -3102,23 +3466,24 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expression/*!*/ e1;
LogicalExpression(out e0, allowSemi, allowLambda);
if (IsImpliesOp() || IsExpliesOp()) {
- if (la.kind == 111 || la.kind == 112) {
+ if (la.kind == 116 || la.kind == 117) {
ImpliesOp();
x = t;
ImpliesExpression(out e1, allowSemi, allowLambda);
e0 = new BinaryExpr(x, BinaryExpr.Opcode.Imp, e0, e1);
- } else if (la.kind == 113 || la.kind == 114) {
+ } else if (la.kind == 118 || la.kind == 119) {
ExpliesOp();
x = t;
LogicalExpression(out e1, allowSemi, allowLambda);
- e0 = new BinaryExpr(x, BinaryExpr.Opcode.Exp, e0, e1);
+ e0 = new BinaryExpr(x, BinaryExpr.Opcode.Exp, e1, e0);
while (IsExpliesOp()) {
ExpliesOp();
x = t;
LogicalExpression(out e1, allowSemi, allowLambda);
- e0 = new BinaryExpr(x, BinaryExpr.Opcode.Exp, e0, e1);
+ e0 = new BinaryExpr(x, BinaryExpr.Opcode.Exp, e1, e0);
+
}
- } else SynErr(214);
+ } else SynErr(225);
}
}
@@ -3126,7 +3491,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expression/*!*/ e1;
RelationalExpression(out e0, allowSemi, allowLambda);
if (IsAndOp() || IsOrOp()) {
- if (la.kind == 115 || la.kind == 116) {
+ if (la.kind == 120 || la.kind == 121) {
AndOp();
x = t;
RelationalExpression(out e1, allowSemi, allowLambda);
@@ -3137,7 +3502,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
RelationalExpression(out e1, allowSemi, allowLambda);
e0 = new BinaryExpr(x, BinaryExpr.Opcode.And, e0, e1);
}
- } else if (la.kind == 117 || la.kind == 118) {
+ } else if (la.kind == 122 || la.kind == 123) {
OrOp();
x = t;
RelationalExpression(out e1, allowSemi, allowLambda);
@@ -3148,7 +3513,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
RelationalExpression(out e1, allowSemi, allowLambda);
e0 = new BinaryExpr(x, BinaryExpr.Opcode.Or, e0, e1);
}
- } else SynErr(215);
+ } else SynErr(226);
}
}
@@ -3281,63 +3646,63 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
k = null;
switch (la.kind) {
- case 52: {
+ case 54: {
Get();
x = t; op = BinaryExpr.Opcode.Eq;
- if (la.kind == 104) {
+ if (la.kind == 109) {
Get();
- Expect(46);
+ Expect(48);
Expression(out k, true, true);
- Expect(47);
+ Expect(49);
}
break;
}
- case 50: {
+ case 52: {
Get();
x = t; op = BinaryExpr.Opcode.Lt;
break;
}
- case 51: {
+ case 53: {
Get();
x = t; op = BinaryExpr.Opcode.Gt;
break;
}
- case 105: {
+ case 110: {
Get();
x = t; op = BinaryExpr.Opcode.Le;
break;
}
- case 106: {
+ case 111: {
Get();
x = t; op = BinaryExpr.Opcode.Ge;
break;
}
- case 53: {
+ case 55: {
Get();
x = t; op = BinaryExpr.Opcode.Neq;
- if (la.kind == 104) {
+ if (la.kind == 109) {
Get();
- Expect(46);
+ Expect(48);
Expression(out k, true, true);
- Expect(47);
+ Expect(49);
}
break;
}
- case 124: {
+ case 129: {
Get();
x = t; op = BinaryExpr.Opcode.In;
break;
}
- case 56: {
+ case 58: {
Get();
x = t; op = BinaryExpr.Opcode.NotIn;
break;
}
- case 119: {
+ case 124: {
Get();
x = t; y = Token.NoToken;
if (la.val == "!") {
- Expect(119);
+ Expect(124);
y = t;
}
if (y == Token.NoToken) {
@@ -3351,22 +3716,22 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
break;
}
- case 54: {
+ case 56: {
Get();
x = t; op = BinaryExpr.Opcode.Neq;
break;
}
- case 107: {
+ case 112: {
Get();
x = t; op = BinaryExpr.Opcode.Le;
break;
}
- case 108: {
+ case 113: {
Get();
x = t; op = BinaryExpr.Opcode.Ge;
break;
}
- default: SynErr(216); break;
+ default: SynErr(227); break;
}
}
@@ -3382,80 +3747,87 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
void AddOp(out IToken x, out BinaryExpr.Opcode op) {
Contract.Ensures(Contract.ValueAtReturn(out x) != null); x = Token.NoToken; op=BinaryExpr.Opcode.Add/*(dummy)*/;
- if (la.kind == 125) {
+ if (la.kind == 76) {
Get();
x = t; op = BinaryExpr.Opcode.Add;
- } else if (la.kind == 126) {
+ } else if (la.kind == 130) {
Get();
x = t; op = BinaryExpr.Opcode.Sub;
- } else SynErr(217);
+ } else SynErr(228);
}
void UnaryExpression(out Expression e, bool allowSemi, bool allowLambda) {
Contract.Ensures(Contract.ValueAtReturn(out e) != null); IToken/*!*/ x; e = dummyExpr;
- if (la.kind == 126) {
+ if (la.kind == 130) {
Get();
x = t;
UnaryExpression(out e, allowSemi, allowLambda);
e = new NegationExpression(x, e);
- } else if (la.kind == 119 || la.kind == 120) {
+ } else if (la.kind == 124 || la.kind == 125) {
NegOp();
x = t;
UnaryExpression(out e, allowSemi, allowLambda);
e = new UnaryOpExpr(x, UnaryOpExpr.Opcode.Not, e);
} else if (IsMapDisplay()) {
- Expect(16);
+ Expect(17);
x = t;
MapDisplayExpr(x, true, out e);
while (IsSuffix()) {
Suffix(ref e);
}
} else if (IsIMapDisplay()) {
- Expect(17);
+ Expect(18);
x = t;
MapDisplayExpr(x, false, out e);
while (IsSuffix()) {
Suffix(ref e);
}
+ } else if (IsISetDisplay()) {
+ Expect(14);
+ x = t;
+ ISetDisplayExpr(x, false, out e);
+ while (IsSuffix()) {
+ Suffix(ref e);
+ }
} else if (IsLambda(allowLambda)) {
LambdaExpression(out e, allowSemi);
- } else if (StartOf(29)) {
+ } else if (StartOf(31)) {
EndlessExpression(out e, allowSemi, allowLambda);
} else if (la.kind == 1) {
NameSegment(out e);
while (IsSuffix()) {
Suffix(ref e);
}
- } else if (la.kind == 44 || la.kind == 46) {
+ } else if (la.kind == 46 || la.kind == 48) {
DisplayExpr(out e);
while (IsSuffix()) {
Suffix(ref e);
}
- } else if (la.kind == 14) {
+ } else if (la.kind == 15) {
MultiSetExpr(out e);
while (IsSuffix()) {
Suffix(ref e);
}
- } else if (StartOf(27)) {
+ } else if (StartOf(29)) {
ConstAtomExpression(out e, allowSemi, allowLambda);
while (IsSuffix()) {
Suffix(ref e);
}
- } else SynErr(218);
+ } else SynErr(229);
}
void MulOp(out IToken x, out BinaryExpr.Opcode op) {
Contract.Ensures(Contract.ValueAtReturn(out x) != null); x = Token.NoToken; op = BinaryExpr.Opcode.Add/*(dummy)*/;
- if (la.kind == 55) {
+ if (la.kind == 57) {
Get();
x = t; op = BinaryExpr.Opcode.Mul;
- } else if (la.kind == 127) {
+ } else if (la.kind == 131) {
Get();
x = t; op = BinaryExpr.Opcode.Div;
- } else if (la.kind == 128) {
+ } else if (la.kind == 132) {
Get();
x = t; op = BinaryExpr.Opcode.Mod;
- } else SynErr(219);
+ } else SynErr(230);
}
void MapDisplayExpr(IToken/*!*/ mapToken, bool finite, out Expression e) {
@@ -3463,12 +3835,12 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
List<ExpressionPair/*!*/>/*!*/ elements= new List<ExpressionPair/*!*/>() ;
e = dummyExpr;
- Expect(46);
- if (StartOf(7)) {
+ Expect(48);
+ if (StartOf(9)) {
MapLiteralExpressions(out elements);
}
e = new MapDisplayExpr(mapToken, finite, elements);
- Expect(47);
+ Expect(49);
}
void Suffix(ref Expression e) {
@@ -3477,66 +3849,83 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression e0 = null; Expression e1 = null; Expression ee; bool anyDots = false;
List<Expression> multipleLengths = null; bool takeRest = false; // takeRest is relevant only if multipleLengths is non-null
List<Expression> multipleIndices = null;
+ List<Tuple<IToken, string, Expression>> updates;
+ Expression v;
- if (la.kind == 25) {
- DotSuffix(out id, out x);
- if (x != null) {
- // process id as a Suffix in its own right
- e = new ExprDotName(id, e, id.val, null);
- id = x; // move to the next Suffix
- }
- IToken openParen = null; List<Type> typeArgs = null; List<Expression> args = null;
-
- if (IsGenericInstantiation()) {
- typeArgs = new List<Type>();
- GenericInstantiation(typeArgs);
- } else if (la.kind == 104) {
- HashCall(id, out openParen, out typeArgs, out args);
- } else if (StartOf(30)) {
- } else SynErr(220);
- e = new ExprDotName(id, e, id.val, typeArgs);
- if (openParen != null) {
- e = new ApplySuffix(openParen, e, args);
- }
-
- } else if (la.kind == 46) {
+ if (la.kind == 27) {
+ Get();
+ if (la.kind == 50) {
+ Get();
+ x = t; updates = new List<Tuple<IToken, string, Expression>>();
+ MemberBindingUpdate(out id, out v);
+ updates.Add(Tuple.Create(id, id.val, v));
+ while (la.kind == 22) {
+ Get();
+ MemberBindingUpdate(out id, out v);
+ updates.Add(Tuple.Create(id, id.val, v));
+ }
+ Expect(51);
+ e = new DatatypeUpdateExpr(x, e, updates);
+ } else if (StartOf(32)) {
+ DotSuffix(out id, out x);
+ if (x != null) {
+ // process id as a Suffix in its own right
+ e = new ExprDotName(id, e, id.val, null);
+ id = x; // move to the next Suffix
+ }
+ IToken openParen = null; List<Type> typeArgs = null; List<Expression> args = null;
+
+ if (IsGenericInstantiation()) {
+ typeArgs = new List<Type>();
+ GenericInstantiation(typeArgs);
+ } else if (la.kind == 109) {
+ HashCall(id, out openParen, out typeArgs, out args);
+ } else if (StartOf(33)) {
+ } else SynErr(231);
+ e = new ExprDotName(id, e, id.val, typeArgs);
+ if (openParen != null) {
+ e = new ApplySuffix(openParen, e, args);
+ }
+
+ } else SynErr(232);
+ } else if (la.kind == 48) {
Get();
x = t;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out ee, true, true);
e0 = ee;
- if (la.kind == 135) {
+ if (la.kind == 139) {
Get();
anyDots = true;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out ee, true, true);
e1 = ee;
}
- } else if (la.kind == 92) {
+ } else if (la.kind == 98) {
Get();
Expression(out ee, true, true);
e1 = ee;
- } else if (la.kind == 20) {
+ } else if (la.kind == 21) {
Get();
multipleLengths = new List<Expression>();
multipleLengths.Add(e0); // account for the Expression read before the colon
takeRest = true;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out ee, true, true);
multipleLengths.Add(ee); takeRest = false;
while (IsNonFinalColon()) {
- Expect(20);
+ Expect(21);
Expression(out ee, true, true);
multipleLengths.Add(ee);
}
- if (la.kind == 20) {
+ if (la.kind == 21) {
Get();
takeRest = true;
}
}
- } else if (la.kind == 21 || la.kind == 47) {
- while (la.kind == 21) {
+ } else if (la.kind == 22 || la.kind == 49) {
+ while (la.kind == 22) {
Get();
Expression(out ee, true, true);
if (multipleIndices == null) {
@@ -3546,15 +3935,15 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
multipleIndices.Add(ee);
}
- } else SynErr(221);
- } else if (la.kind == 135) {
+ } else SynErr(233);
+ } else if (la.kind == 139) {
Get();
anyDots = true;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expression(out ee, true, true);
e1 = ee;
}
- } else SynErr(222);
+ } else SynErr(234);
if (multipleIndices != null) {
e = new MultiSelectExpr(x, e, multipleIndices);
// make sure an array class with this dimensionality exists
@@ -3589,16 +3978,29 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
}
- Expect(47);
- } else if (la.kind == 48) {
+ Expect(49);
+ } else if (la.kind == 50) {
Get();
IToken openParen = t; var args = new List<Expression>();
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(args);
}
- Expect(49);
+ Expect(51);
e = new ApplySuffix(openParen, e, args);
- } else SynErr(223);
+ } else SynErr(235);
+ }
+
+ void ISetDisplayExpr(IToken/*!*/ setToken, bool finite, out Expression e) {
+ Contract.Ensures(Contract.ValueAtReturn(out e) != null);
+ List<Expression> elements = new List<Expression/*!*/>();;
+ e = dummyExpr;
+
+ Expect(46);
+ if (StartOf(9)) {
+ Expressions(elements);
+ }
+ e = new SetDisplayExpr(setToken, finite, elements);
+ Expect(47);
}
void LambdaExpression(out Expression e, bool allowSemi) {
@@ -3614,22 +4016,22 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
if (la.kind == 1) {
WildIdent(out id, true);
x = t; bvs.Add(new BoundVar(id, id.val, new InferredTypeProxy()));
- } else if (la.kind == 48) {
+ } else if (la.kind == 50) {
Get();
x = t;
if (la.kind == 1) {
IdentTypeOptional(out bv);
bvs.Add(bv);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
IdentTypeOptional(out bv);
bvs.Add(bv);
}
}
- Expect(49);
- } else SynErr(224);
- while (la.kind == 42 || la.kind == 43) {
- if (la.kind == 42) {
+ Expect(51);
+ } else SynErr(236);
+ while (la.kind == 44 || la.kind == 45) {
+ if (la.kind == 44) {
Get();
PossiblyWildFrameExpression(out fe, true);
reads.Add(fe);
@@ -3653,56 +4055,64 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
e = dummyExpr;
switch (la.kind) {
- case 96: {
+ case 101: {
Get();
x = t;
Expression(out e, true, true);
- Expect(32);
+ Expect(34);
Expression(out e0, true, true);
- Expect(33);
+ Expect(35);
Expression(out e1, allowSemi, allowLambda);
e = new ITEExpr(x, e, e0, e1);
break;
}
- case 98: {
+ case 103: {
MatchExpression(out e, allowSemi, allowLambda);
break;
}
- case 101: case 121: case 122: case 123: {
+ case 106: case 126: case 127: case 128: {
QuantifierGuts(out e, allowSemi, allowLambda);
break;
}
case 13: {
- SetComprehensionExpr(out e, allowSemi, allowLambda);
+ Get();
+ x = t;
+ SetComprehensionExpr(x, true, out e, allowSemi, allowLambda);
+ break;
+ }
+ case 14: {
+ Get();
+ x = t;
+ SetComprehensionExpr(x, false, out e, allowSemi, allowLambda);
break;
}
- case 29: case 30: case 99: {
+ case 31: case 32: case 104: {
StmtInExpr(out s);
Expression(out e, allowSemi, allowLambda);
e = new StmtExpr(s.Tok, s, e);
break;
}
- case 70: case 75: {
+ case 62: case 81: {
LetExpr(out e, allowSemi, allowLambda);
break;
}
- case 16: {
+ case 17: {
Get();
x = t;
MapComprehensionExpr(x, true, out e, allowSemi, allowLambda);
break;
}
- case 17: {
+ case 18: {
Get();
x = t;
MapComprehensionExpr(x, false, out e, allowSemi, allowLambda);
break;
}
- case 89: {
+ case 95: {
NamedExpr(out e, allowSemi, allowLambda);
break;
}
- default: SynErr(225); break;
+ default: SynErr(237); break;
}
}
@@ -3714,10 +4124,10 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
if (IsGenericInstantiation()) {
typeArgs = new List<Type>();
GenericInstantiation(typeArgs);
- } else if (la.kind == 104) {
+ } else if (la.kind == 109) {
HashCall(id, out openParen, out typeArgs, out args);
- } else if (StartOf(30)) {
- } else SynErr(226);
+ } else if (StartOf(33)) {
+ } else SynErr(238);
e = new NameSegment(id, id.val, typeArgs);
if (openParen != null) {
e = new ApplySuffix(openParen, e, args);
@@ -3730,23 +4140,23 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken x; List<Expression> elements;
e = dummyExpr;
- if (la.kind == 44) {
+ if (la.kind == 46) {
Get();
x = t; elements = new List<Expression/*!*/>();
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(elements);
}
- e = new SetDisplayExpr(x, elements);
- Expect(45);
- } else if (la.kind == 46) {
+ e = new SetDisplayExpr(x, true, elements);
+ Expect(47);
+ } else if (la.kind == 48) {
Get();
x = t; elements = new List<Expression/*!*/>();
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(elements);
}
e = new SeqDisplayExpr(x, elements);
- Expect(47);
- } else SynErr(227);
+ Expect(49);
+ } else SynErr(239);
}
void MultiSetExpr(out Expression e) {
@@ -3754,23 +4164,23 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken/*!*/ x = null; List<Expression/*!*/>/*!*/ elements;
e = dummyExpr;
- Expect(14);
+ Expect(15);
x = t;
- if (la.kind == 44) {
+ if (la.kind == 46) {
Get();
elements = new List<Expression/*!*/>();
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(elements);
}
e = new MultiSetDisplayExpr(x, elements);
- Expect(45);
- } else if (la.kind == 48) {
+ Expect(47);
+ } else if (la.kind == 50) {
Get();
x = t; elements = new List<Expression/*!*/>();
Expression(out e, true, true);
e = new MultiSetFormingExpr(x, e);
- Expect(49);
- } else SynErr(228);
+ Expect(51);
+ } else SynErr(240);
}
void ConstAtomExpression(out Expression e, bool allowSemi, bool allowLambda) {
@@ -3779,17 +4189,17 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
e = dummyExpr; Type toType = null;
switch (la.kind) {
- case 129: {
+ case 133: {
Get();
e = new LiteralExpr(t, false);
break;
}
- case 130: {
+ case 134: {
Get();
e = new LiteralExpr(t, true);
break;
}
- case 131: {
+ case 135: {
Get();
e = new LiteralExpr(t);
break;
@@ -3804,12 +4214,12 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
e = new LiteralExpr(t, d);
break;
}
- case 18: {
+ case 19: {
Get();
e = new CharLiteralExpr(t, t.val.Substring(1, t.val.Length - 2));
break;
}
- case 19: {
+ case 20: {
Get();
bool isVerbatimString;
string s = Util.RemoveParsedStringQuotes(t.val, out isVerbatimString);
@@ -3817,35 +4227,35 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
break;
}
- case 132: {
+ case 136: {
Get();
e = new ThisExpr(t);
break;
}
- case 133: {
+ case 137: {
Get();
x = t;
- Expect(48);
+ Expect(50);
Expression(out e, true, true);
- Expect(49);
+ Expect(51);
e = new UnaryOpExpr(x, UnaryOpExpr.Opcode.Fresh, e);
break;
}
- case 134: {
+ case 138: {
Get();
x = t;
- Expect(48);
+ Expect(50);
Expression(out e, true, true);
- Expect(49);
+ Expect(51);
e = new OldExpr(x, e);
break;
}
- case 22: {
+ case 23: {
Get();
x = t;
Expression(out e, true, true);
e = new UnaryOpExpr(x, UnaryOpExpr.Opcode.Cardinality, e);
- Expect(22);
+ Expect(23);
break;
}
case 8: case 10: {
@@ -3856,17 +4266,17 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Get();
x = t; toType = new RealType();
}
- Expect(48);
+ Expect(50);
Expression(out e, true, true);
- Expect(49);
+ Expect(51);
e = new ConversionExpr(x, e, toType);
break;
}
- case 48: {
+ case 50: {
ParensExpression(out e, allowSemi, allowLambda);
break;
}
- default: SynErr(229); break;
+ default: SynErr(241); break;
}
}
@@ -3878,7 +4288,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Get();
S = Util.RemoveUnderscores(t.val);
try {
- n = BigInteger.Parse(S);
+ n = BigIntegerParser.Parse(S);
} catch (System.FormatException) {
SemErr("incorrectly formatted number");
n = BigInteger.Zero;
@@ -3889,13 +4299,13 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
S = Util.RemoveUnderscores(t.val.Substring(2));
try {
// note: leading 0 required when parsing positive hex numbers
- n = BigInteger.Parse("0" + S, System.Globalization.NumberStyles.HexNumber);
+ n = BigIntegerParser.Parse("0" + S, System.Globalization.NumberStyles.HexNumber);
} catch (System.FormatException) {
SemErr("incorrectly formatted number");
n = BigInteger.Zero;
}
- } else SynErr(230);
+ } else SynErr(242);
}
void Dec(out Basetypes.BigDec d) {
@@ -3915,12 +4325,12 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IToken x;
var args = new List<Expression>();
- Expect(48);
+ Expect(50);
x = t;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(args);
}
- Expect(49);
+ Expect(51);
if (args.Count == 1) {
e = new ParensExpression(x, args[0]);
} else {
@@ -3933,26 +4343,26 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
void LambdaArrow(out bool oneShot) {
oneShot = true;
- if (la.kind == 27) {
+ if (la.kind == 29) {
Get();
oneShot = false;
- } else if (la.kind == 28) {
+ } else if (la.kind == 30) {
Get();
oneShot = true;
- } else SynErr(231);
+ } else SynErr(243);
}
void MapLiteralExpressions(out List<ExpressionPair> elements) {
Expression/*!*/ d, r;
elements = new List<ExpressionPair/*!*/>();
Expression(out d, true, true);
- Expect(92);
+ Expect(98);
Expression(out r, true, true);
elements.Add(new ExpressionPair(d,r));
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Expression(out d, true, true);
- Expect(92);
+ Expect(98);
Expression(out r, true, true);
elements.Add(new ExpressionPair(d,r));
}
@@ -3968,10 +4378,10 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
IdentTypeOptional(out bv);
bvars.Add(bv);
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
- if (la.kind == 22) {
+ if (la.kind == 23) {
Get();
Expression(out range, true, true);
}
@@ -3986,23 +4396,23 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
List<MatchCaseExpr/*!*/> cases = new List<MatchCaseExpr/*!*/>();
bool usesOptionalBrace = false;
- Expect(98);
+ Expect(103);
x = t;
Expression(out e, allowSemi, allowLambda);
if (la.kind == _lbrace) {
- Expect(44);
+ Expect(46);
usesOptionalBrace = true;
- while (la.kind == 31) {
+ while (la.kind == 33) {
CaseExpression(out c, true, true);
cases.Add(c);
}
- Expect(45);
- } else if (StartOf(31)) {
+ Expect(47);
+ } else if (StartOf(34)) {
while (la.kind == _case) {
CaseExpression(out c, allowSemi, allowLambda);
cases.Add(c);
}
- } else SynErr(232);
+ } else SynErr(244);
e = new MatchExpr(x, e, cases, usesOptionalBrace);
}
@@ -4014,13 +4424,13 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression range;
Expression/*!*/ body;
- if (la.kind == 101 || la.kind == 121) {
+ if (la.kind == 106 || la.kind == 126) {
Forall();
x = t; univ = true;
- } else if (la.kind == 122 || la.kind == 123) {
+ } else if (la.kind == 127 || la.kind == 128) {
Exists();
x = t;
- } else SynErr(233);
+ } else SynErr(245);
QuantifierDomain(out bvars, out attrs, out range);
QSep();
Expression(out body, allowSemi, allowLambda);
@@ -4032,47 +4442,44 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
- void SetComprehensionExpr(out Expression q, bool allowSemi, bool allowLambda) {
+ void SetComprehensionExpr(IToken setToken, bool finite, out Expression q, bool allowSemi, bool allowLambda) {
Contract.Ensures(Contract.ValueAtReturn(out q) != null);
- IToken x = Token.NoToken;
BoundVar bv;
List<BoundVar/*!*/> bvars = new List<BoundVar>();
Expression range;
Expression body = null;
Attributes attrs = null;
- Expect(13);
- x = t;
IdentTypeOptional(out bv);
bvars.Add(bv);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
IdentTypeOptional(out bv);
bvars.Add(bv);
}
- while (la.kind == 44) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
- Expect(22);
+ Expect(23);
Expression(out range, allowSemi, allowLambda);
if (IsQSep()) {
QSep();
Expression(out body, allowSemi, allowLambda);
}
if (body == null && bvars.Count != 1) { SemErr(t, "a set comprehension with more than one bound variable must have a term expression"); }
- q = new SetComprehension(x, bvars, range, body, attrs);
+ q = new SetComprehension(setToken, finite, bvars, range, body, attrs);
}
void StmtInExpr(out Statement s) {
s = dummyStmt;
- if (la.kind == 99) {
+ if (la.kind == 104) {
AssertStmt(out s);
- } else if (la.kind == 29) {
+ } else if (la.kind == 31) {
AssumeStmt(out s);
- } else if (la.kind == 30) {
+ } else if (la.kind == 32) {
CalcStmt(out s);
- } else SynErr(234);
+ } else SynErr(246);
}
void LetExpr(out Expression e, bool allowSemi, bool allowLambda) {
@@ -4085,30 +4492,30 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Attributes attrs = null;
e = dummyExpr;
- if (la.kind == 70) {
+ if (la.kind == 62) {
Get();
isGhost = true; x = t;
}
- Expect(75);
+ Expect(81);
if (!isGhost) { x = t; }
CasePattern(out pat);
if (isGhost) { pat.Vars.Iter(bv => bv.IsGhost = true); }
letLHSs.Add(pat);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
CasePattern(out pat);
if (isGhost) { pat.Vars.Iter(bv => bv.IsGhost = true); }
letLHSs.Add(pat);
}
- if (la.kind == 92) {
+ if (la.kind == 98) {
Get();
- } else if (la.kind == 44 || la.kind == 94) {
- while (la.kind == 44) {
+ } else if (la.kind == 25 || la.kind == 46) {
+ while (la.kind == 46) {
Attribute(ref attrs);
}
- Expect(94);
+ Expect(25);
exact = false;
foreach (var lhs in letLHSs) {
if (lhs.Arguments != null) {
@@ -4116,15 +4523,15 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
}
- } else SynErr(235);
+ } else SynErr(247);
Expression(out e, false, true);
letRHSs.Add(e);
- while (la.kind == 21) {
+ while (la.kind == 22) {
Get();
Expression(out e, false, true);
letRHSs.Add(e);
}
- Expect(26);
+ Expect(28);
Expression(out e, allowSemi, allowLambda);
e = new LetExpr(x, letLHSs, letRHSs, e, exact, attrs);
}
@@ -4134,89 +4541,87 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
e = dummyExpr;
Expression expr;
- Expect(89);
+ Expect(95);
x = t;
NoUSIdent(out d);
- Expect(20);
+ Expect(21);
Expression(out e, allowSemi, allowLambda);
expr = e;
e = new NamedExpr(x, d.val, expr);
}
- void CasePattern(out CasePattern pat) {
- IToken id; List<CasePattern> arguments;
- BoundVar bv;
- pat = null;
+ void CaseExpression(out MatchCaseExpr c, bool allowSemi, bool allowLambda) {
+ Contract.Ensures(Contract.ValueAtReturn(out c) != null); IToken/*!*/ x, id;
+ List<CasePattern/*!*/> arguments = new List<CasePattern/*!*/>();
+ CasePattern/*!*/ pat;
+ Expression/*!*/ body;
+ string/*!*/ name = "";
- if (IsIdentParen()) {
+ Expect(33);
+ x = t;
+ if (la.kind == 1) {
Ident(out id);
- Expect(48);
- arguments = new List<CasePattern>();
- if (la.kind == 1) {
- CasePattern(out pat);
- arguments.Add(pat);
- while (la.kind == 21) {
- Get();
+ name = id.val;
+ if (la.kind == 50) {
+ Get();
+ if (la.kind == 1 || la.kind == 50) {
CasePattern(out pat);
arguments.Add(pat);
+ while (la.kind == 22) {
+ Get();
+ CasePattern(out pat);
+ arguments.Add(pat);
+ }
}
+ Expect(51);
}
- Expect(49);
- pat = new CasePattern(id, id.val, arguments);
- } else if (la.kind == 1) {
- IdentTypeOptional(out bv);
- pat = new CasePattern(bv.tok, bv);
-
- } else SynErr(236);
- if (pat == null) {
- pat = new CasePattern(t, "_ParseError", new List<CasePattern>());
- }
-
- }
-
- void CaseExpression(out MatchCaseExpr c, bool allowSemi, bool allowLambda) {
- Contract.Ensures(Contract.ValueAtReturn(out c) != null); IToken/*!*/ x, id;
- List<BoundVar/*!*/> arguments = new List<BoundVar/*!*/>();
- BoundVar/*!*/ bv;
- Expression/*!*/ body;
-
- Expect(31);
- x = t;
- Ident(out id);
- if (la.kind == 48) {
+ } else if (la.kind == 50) {
Get();
- IdentTypeOptional(out bv);
- arguments.Add(bv);
- while (la.kind == 21) {
+ CasePattern(out pat);
+ arguments.Add(pat);
+ while (la.kind == 22) {
Get();
- IdentTypeOptional(out bv);
- arguments.Add(bv);
+ CasePattern(out pat);
+ arguments.Add(pat);
}
- Expect(49);
- }
- Expect(27);
+ Expect(51);
+ } else SynErr(248);
+ Expect(29);
Expression(out body, allowSemi, allowLambda);
- c = new MatchCaseExpr(x, id.val, arguments, body);
+ c = new MatchCaseExpr(x, name, arguments, body);
}
void HashCall(IToken id, out IToken openParen, out List<Type> typeArgs, out List<Expression> args) {
Expression k; args = new List<Expression>(); typeArgs = null;
- Expect(104);
+ Expect(109);
id.val = id.val + "#";
- if (la.kind == 50) {
+ if (la.kind == 52) {
typeArgs = new List<Type>();
GenericInstantiation(typeArgs);
}
- Expect(46);
+ Expect(48);
Expression(out k, true, true);
- Expect(47);
+ Expect(49);
args.Add(k);
- Expect(48);
+ Expect(50);
openParen = t;
- if (StartOf(7)) {
+ if (StartOf(9)) {
Expressions(args);
}
- Expect(49);
+ Expect(51);
+ }
+
+ void MemberBindingUpdate(out IToken id, out Expression e) {
+ id = Token.NoToken; e = dummyExpr;
+ if (la.kind == 1) {
+ Get();
+ id = t;
+ } else if (la.kind == 2) {
+ Get();
+ id = t;
+ } else SynErr(249);
+ Expect(98);
+ Expression(out e, true, true);
}
void DotSuffix(out IToken x, out IToken y) {
@@ -4224,7 +4629,6 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
x = Token.NoToken;
y = null;
- Expect(25);
if (la.kind == 1) {
Get();
x = t;
@@ -4252,13 +4656,13 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
}
- } else if (la.kind == 43) {
+ } else if (la.kind == 45) {
Get();
x = t;
- } else if (la.kind == 42) {
+ } else if (la.kind == 44) {
Get();
x = t;
- } else SynErr(237);
+ } else SynErr(250);
}
@@ -4270,61 +4674,66 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Dafny();
Expect(0);
- Expect(0);
}
- static readonly bool[,]/*!*/ set = {
- {_T,_T,_T,_T, _T,_x,_x,_x, _T,_x,_T,_x, _x,_x,_x,_x, _x,_x,_T,_T, _x,_x,_T,_x, _x,_x,_T,_x, _x,_T,_T,_T, _x,_x,_T,_T, _x,_x,_T,_T, _x,_T,_T,_T, _T,_T,_x,_x, _T,_x,_x,_x, _x,_x,_x,_x, _x,_T,_x,_x, _x,_x,_x,_x, _x,_x,_x,_T, _x,_T,_T,_x, _x,_T,_T,_T, _x,_x,_T,_x, _x,_T,_T,_T, _T,_T,_T,_T, _x,_T,_T,_x, _x,_T,_x,_x, _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,_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,_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,_T, _T,_x,_T,_x, _x,_x,_x,_T, _x,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_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,_x,_x,_x, _x,_x,_x,_x, _x,_x,_x,_x,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x,_x,_x, _T,_x,_T,_x, _x,_x,_x,_x, _x,_x,_x,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _x,_T,_T,_T, _T,_T,_T,_x, _x,_T,_x,_x, _x,_T,_T,_x, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_x,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_T,_T, _x,_T,_T,_T, _T,_T,_T,_T, _T,_x,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_x,_x, _x,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _x,_x},
+ {_T,_T,_T,_T, _T,_x,_x,_x, _T,_x,_T,_x, _x,_x,_x,_x, _x,_x,_x,_T, _T,_T,_T,_T, _T,_x,_T,_x, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _x,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _x,_T,_T,_T, _T,_T,_T,_x, _x,_T,_x,_x, _x,_T,_T,_x, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_x,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_T,_T, _x,_T,_T,_T, _T,_T,_T,_T, _T,_x,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _T,_x,_x,_x, _x,_T,_T,_T, _T,_T,_T,_T, _T,_T,_T,_T, _x,_x}
};
} // end Parser
public class Errors {
- public int count = 0; // number of errors detected
- public System.IO.TextWriter/*!*/ errorStream = Console.Out; // error messages go to this stream
- public string errMsgFormat = "{0}({1},{2}): error: {3}"; // 0=filename, 1=line, 2=column, 3=text
- public string warningMsgFormat = "{0}({1},{2}): warning: {3}"; // 0=filename, 1=line, 2=column, 3=text
+ readonly ErrorReporter Reporting;
+ public int ErrorCount;
+
+ public Errors(ErrorReporter Reporting) {
+ Contract.Requires(Reporting != null);
+ this.Reporting = Reporting;
+ }
public void SynErr(string filename, int line, int col, int n) {
SynErr(filename, line, col, GetSyntaxErrorString(n));
}
- public virtual void SynErr(string filename, int line, int col, string/*!*/ msg) {
+ public void SynErr(string filename, int line, int col, string msg) {
Contract.Requires(msg != null);
- errorStream.WriteLine(errMsgFormat, filename, line, col, msg);
- count++;
+ ErrorCount++;
+ Reporting.Error(MessageSource.Parser, filename, line, col, msg);
}
string GetSyntaxErrorString(int n) {
@@ -4344,257 +4753,266 @@ public class Errors {
case 11: s = "object expected"; break;
case 12: s = "string expected"; break;
case 13: s = "set expected"; break;
- case 14: s = "multiset expected"; break;
- case 15: s = "seq expected"; break;
- case 16: s = "map expected"; break;
- case 17: s = "imap expected"; break;
- case 18: s = "charToken expected"; break;
- case 19: s = "stringToken expected"; break;
- case 20: s = "colon expected"; break;
- case 21: s = "comma expected"; break;
- case 22: s = "verticalbar expected"; break;
- case 23: s = "doublecolon expected"; break;
- case 24: s = "bullet expected"; break;
- case 25: s = "dot expected"; break;
- case 26: s = "semi expected"; break;
- case 27: s = "darrow expected"; break;
- case 28: s = "arrow expected"; break;
- case 29: s = "assume expected"; break;
- case 30: s = "calc expected"; break;
- case 31: s = "case expected"; break;
- case 32: s = "then expected"; break;
- case 33: s = "else expected"; break;
- case 34: s = "decreases expected"; break;
- case 35: s = "invariant expected"; break;
- case 36: s = "function expected"; break;
- case 37: s = "predicate expected"; break;
- case 38: s = "inductive expected"; break;
- case 39: s = "lemma expected"; break;
- case 40: s = "copredicate expected"; break;
- case 41: s = "modifies expected"; break;
- case 42: s = "reads expected"; break;
- case 43: s = "requires expected"; break;
- case 44: s = "lbrace expected"; break;
- case 45: s = "rbrace expected"; break;
- case 46: s = "lbracket expected"; break;
- case 47: s = "rbracket expected"; break;
- case 48: s = "openparen expected"; break;
- case 49: s = "closeparen expected"; break;
- case 50: s = "openAngleBracket expected"; break;
- case 51: s = "closeAngleBracket expected"; break;
- case 52: s = "eq expected"; break;
- case 53: s = "neq expected"; break;
- case 54: s = "neqAlt expected"; break;
- case 55: s = "star expected"; break;
- case 56: s = "notIn expected"; break;
- case 57: s = "ellipsis expected"; break;
- case 58: s = "\"include\" expected"; break;
- case 59: s = "\"abstract\" expected"; break;
- case 60: s = "\"module\" expected"; break;
- case 61: s = "\"refines\" expected"; break;
- case 62: s = "\"import\" expected"; break;
- case 63: s = "\"opened\" expected"; break;
- case 64: s = "\"=\" expected"; break;
- case 65: s = "\"as\" expected"; break;
- case 66: s = "\"default\" expected"; break;
- case 67: s = "\"class\" expected"; break;
- case 68: s = "\"extends\" expected"; break;
- case 69: s = "\"trait\" expected"; break;
- case 70: s = "\"ghost\" expected"; break;
- case 71: s = "\"static\" expected"; break;
- case 72: s = "\"protected\" expected"; break;
- case 73: s = "\"datatype\" expected"; break;
- case 74: s = "\"codatatype\" expected"; break;
- case 75: s = "\"var\" expected"; break;
- case 76: s = "\"newtype\" expected"; break;
- case 77: s = "\"type\" expected"; break;
- case 78: s = "\"iterator\" expected"; break;
- case 79: s = "\"yields\" expected"; break;
- case 80: s = "\"returns\" expected"; break;
- case 81: s = "\"method\" expected"; break;
- case 82: s = "\"colemma\" expected"; break;
- case 83: s = "\"comethod\" expected"; break;
- case 84: s = "\"constructor\" expected"; break;
- case 85: s = "\"free\" expected"; break;
- case 86: s = "\"ensures\" expected"; break;
- case 87: s = "\"yield\" expected"; break;
- case 88: s = "\"`\" expected"; break;
- case 89: s = "\"label\" expected"; break;
- case 90: s = "\"break\" expected"; break;
- case 91: s = "\"where\" expected"; break;
- case 92: s = "\":=\" expected"; break;
- case 93: s = "\"return\" expected"; break;
- case 94: s = "\":|\" expected"; break;
- case 95: s = "\"new\" expected"; break;
- case 96: s = "\"if\" expected"; break;
- case 97: s = "\"while\" expected"; break;
- case 98: s = "\"match\" expected"; break;
- case 99: s = "\"assert\" expected"; break;
- case 100: s = "\"print\" expected"; break;
- case 101: s = "\"forall\" expected"; break;
- case 102: s = "\"parallel\" expected"; break;
- case 103: s = "\"modify\" expected"; break;
- case 104: s = "\"#\" expected"; break;
- case 105: s = "\"<=\" expected"; break;
- case 106: s = "\">=\" expected"; break;
- case 107: s = "\"\\u2264\" expected"; break;
- case 108: s = "\"\\u2265\" expected"; break;
- case 109: s = "\"<==>\" expected"; break;
- case 110: s = "\"\\u21d4\" expected"; break;
- case 111: s = "\"==>\" expected"; break;
- case 112: s = "\"\\u21d2\" expected"; break;
- case 113: s = "\"<==\" expected"; break;
- case 114: s = "\"\\u21d0\" expected"; break;
- case 115: s = "\"&&\" expected"; break;
- case 116: s = "\"\\u2227\" expected"; break;
- case 117: s = "\"||\" expected"; break;
- case 118: s = "\"\\u2228\" expected"; break;
- case 119: s = "\"!\" expected"; break;
- case 120: s = "\"\\u00ac\" expected"; break;
- case 121: s = "\"\\u2200\" expected"; break;
- case 122: s = "\"exists\" expected"; break;
- case 123: s = "\"\\u2203\" expected"; break;
- case 124: s = "\"in\" expected"; break;
- case 125: s = "\"+\" expected"; break;
- case 126: s = "\"-\" expected"; break;
- case 127: s = "\"/\" expected"; break;
- case 128: s = "\"%\" expected"; break;
- case 129: s = "\"false\" expected"; break;
- case 130: s = "\"true\" expected"; break;
- case 131: s = "\"null\" expected"; break;
- case 132: s = "\"this\" expected"; break;
- case 133: s = "\"fresh\" expected"; break;
- case 134: s = "\"old\" expected"; break;
- case 135: s = "\"..\" expected"; break;
- case 136: s = "??? expected"; break;
- case 137: s = "this symbol not expected in SubModuleDecl"; break;
- case 138: s = "invalid SubModuleDecl"; break;
- case 139: s = "this symbol not expected in ClassDecl"; break;
- case 140: s = "this symbol not expected in DatatypeDecl"; break;
- case 141: s = "invalid DatatypeDecl"; break;
- case 142: s = "this symbol not expected in DatatypeDecl"; break;
- case 143: s = "invalid NewtypeDecl"; break;
- case 144: s = "invalid OtherTypeDecl"; break;
- case 145: s = "this symbol not expected in OtherTypeDecl"; break;
- case 146: s = "this symbol not expected in IteratorDecl"; break;
- case 147: s = "invalid IteratorDecl"; break;
- case 148: s = "this symbol not expected in TraitDecl"; break;
- case 149: s = "invalid ClassMemberDecl"; break;
- case 150: s = "this symbol not expected in FieldDecl"; break;
- case 151: s = "invalid FunctionDecl"; break;
- case 152: s = "invalid FunctionDecl"; break;
- case 153: s = "invalid FunctionDecl"; break;
- case 154: s = "invalid FunctionDecl"; break;
- case 155: s = "invalid FunctionDecl"; break;
- case 156: s = "this symbol not expected in MethodDecl"; break;
- case 157: s = "invalid MethodDecl"; break;
- case 158: s = "invalid MethodDecl"; break;
- case 159: s = "invalid FIdentType"; break;
- case 160: s = "this symbol not expected in OldSemi"; break;
- case 161: s = "invalid TypeIdentOptional"; break;
- case 162: s = "invalid TypeAndToken"; break;
- case 163: s = "this symbol not expected in IteratorSpec"; break;
- case 164: s = "invalid IteratorSpec"; break;
- case 165: s = "invalid IteratorSpec"; break;
- case 166: s = "this symbol not expected in MethodSpec"; break;
- case 167: s = "invalid MethodSpec"; break;
- case 168: s = "invalid MethodSpec"; break;
- case 169: s = "invalid FrameExpression"; break;
- case 170: s = "this symbol not expected in FunctionSpec"; break;
- case 171: s = "invalid FunctionSpec"; break;
- case 172: s = "invalid PossiblyWildFrameExpression"; break;
- case 173: s = "invalid PossiblyWildExpression"; break;
- case 174: s = "this symbol not expected in OneStmt"; break;
- case 175: s = "invalid OneStmt"; break;
- case 176: s = "this symbol not expected in OneStmt"; break;
- case 177: s = "invalid OneStmt"; break;
- case 178: s = "invalid AssertStmt"; break;
- case 179: s = "invalid AssumeStmt"; break;
- case 180: s = "invalid UpdateStmt"; break;
- case 181: s = "invalid UpdateStmt"; break;
- case 182: s = "this symbol not expected in VarDeclStatement"; break;
- case 183: s = "invalid IfStmt"; break;
- case 184: s = "invalid IfStmt"; break;
- case 185: s = "invalid WhileStmt"; break;
- case 186: s = "invalid WhileStmt"; break;
- case 187: s = "invalid MatchStmt"; break;
- case 188: s = "invalid ForallStmt"; break;
- case 189: s = "invalid ForallStmt"; break;
- case 190: s = "invalid CalcStmt"; break;
- case 191: s = "invalid ModifyStmt"; break;
- case 192: s = "this symbol not expected in ModifyStmt"; break;
- case 193: s = "invalid ModifyStmt"; break;
- case 194: s = "invalid ReturnStmt"; break;
- case 195: s = "invalid Rhs"; break;
- case 196: s = "invalid Lhs"; break;
- case 197: s = "invalid Guard"; break;
- case 198: s = "this symbol not expected in LoopSpec"; break;
- case 199: s = "this symbol not expected in LoopSpec"; break;
- case 200: s = "this symbol not expected in LoopSpec"; break;
- case 201: s = "invalid LoopSpec"; break;
- case 202: s = "this symbol not expected in CaseStatement"; break;
- case 203: s = "this symbol not expected in CaseStatement"; break;
- case 204: s = "invalid CalcOp"; break;
- case 205: s = "invalid EquivOp"; break;
- case 206: s = "invalid ImpliesOp"; break;
- case 207: s = "invalid ExpliesOp"; break;
- case 208: s = "invalid AndOp"; break;
- case 209: s = "invalid OrOp"; break;
- case 210: s = "invalid NegOp"; break;
- case 211: s = "invalid Forall"; break;
- case 212: s = "invalid Exists"; break;
- case 213: s = "invalid QSep"; break;
- case 214: s = "invalid ImpliesExpliesExpression"; break;
- case 215: s = "invalid LogicalExpression"; break;
- case 216: s = "invalid RelOp"; break;
- case 217: s = "invalid AddOp"; break;
- case 218: s = "invalid UnaryExpression"; break;
- case 219: s = "invalid MulOp"; break;
- case 220: s = "invalid Suffix"; break;
- case 221: s = "invalid Suffix"; break;
- case 222: s = "invalid Suffix"; break;
- case 223: s = "invalid Suffix"; break;
- case 224: s = "invalid LambdaExpression"; break;
- case 225: s = "invalid EndlessExpression"; break;
- case 226: s = "invalid NameSegment"; break;
- case 227: s = "invalid DisplayExpr"; break;
- case 228: s = "invalid MultiSetExpr"; break;
- case 229: s = "invalid ConstAtomExpression"; break;
- case 230: s = "invalid Nat"; break;
- case 231: s = "invalid LambdaArrow"; break;
- case 232: s = "invalid MatchExpression"; break;
- case 233: s = "invalid QuantifierGuts"; break;
- case 234: s = "invalid StmtInExpr"; break;
- case 235: s = "invalid LetExpr"; break;
- case 236: s = "invalid CasePattern"; break;
- case 237: s = "invalid DotSuffix"; break;
+ case 14: s = "iset expected"; break;
+ case 15: s = "multiset expected"; break;
+ case 16: s = "seq expected"; break;
+ case 17: s = "map expected"; break;
+ case 18: s = "imap expected"; break;
+ case 19: s = "charToken expected"; break;
+ case 20: s = "stringToken expected"; break;
+ case 21: s = "colon expected"; break;
+ case 22: s = "comma expected"; break;
+ case 23: s = "verticalbar expected"; break;
+ case 24: s = "doublecolon expected"; break;
+ case 25: s = "boredSmiley expected"; break;
+ case 26: s = "bullet expected"; break;
+ case 27: s = "dot expected"; break;
+ case 28: s = "semi expected"; break;
+ case 29: s = "darrow expected"; break;
+ case 30: s = "arrow expected"; break;
+ case 31: s = "assume expected"; break;
+ case 32: s = "calc expected"; break;
+ case 33: s = "case expected"; break;
+ case 34: s = "then expected"; break;
+ case 35: s = "else expected"; break;
+ case 36: s = "decreases expected"; break;
+ case 37: s = "invariant expected"; break;
+ case 38: s = "function expected"; break;
+ case 39: s = "predicate expected"; break;
+ case 40: s = "inductive expected"; break;
+ case 41: s = "lemma expected"; break;
+ case 42: s = "copredicate expected"; break;
+ case 43: s = "modifies expected"; break;
+ case 44: s = "reads expected"; break;
+ case 45: s = "requires expected"; break;
+ case 46: s = "lbrace expected"; break;
+ case 47: s = "rbrace expected"; break;
+ case 48: s = "lbracket expected"; break;
+ case 49: s = "rbracket expected"; break;
+ case 50: s = "openparen expected"; break;
+ case 51: s = "closeparen expected"; break;
+ case 52: s = "openAngleBracket expected"; break;
+ case 53: s = "closeAngleBracket expected"; break;
+ case 54: s = "eq expected"; break;
+ case 55: s = "neq expected"; break;
+ case 56: s = "neqAlt expected"; break;
+ case 57: s = "star expected"; break;
+ case 58: s = "notIn expected"; break;
+ case 59: s = "ellipsis expected"; break;
+ case 60: s = "\"include\" expected"; break;
+ case 61: s = "\"abstract\" expected"; break;
+ case 62: s = "\"ghost\" expected"; break;
+ case 63: s = "\"static\" expected"; break;
+ case 64: s = "\"protected\" expected"; break;
+ case 65: s = "\"extern\" expected"; break;
+ case 66: s = "\"module\" expected"; break;
+ case 67: s = "\"exclusively\" expected"; break;
+ case 68: s = "\"refines\" expected"; break;
+ case 69: s = "\"import\" expected"; break;
+ case 70: s = "\"opened\" expected"; break;
+ case 71: s = "\"=\" expected"; break;
+ case 72: s = "\"as\" expected"; break;
+ case 73: s = "\"default\" expected"; break;
+ case 74: s = "\"export\" expected"; break;
+ case 75: s = "\"extends\" expected"; break;
+ case 76: s = "\"+\" expected"; break;
+ case 77: s = "\"class\" expected"; break;
+ case 78: s = "\"trait\" expected"; break;
+ case 79: s = "\"datatype\" expected"; break;
+ case 80: s = "\"codatatype\" expected"; break;
+ case 81: s = "\"var\" expected"; break;
+ case 82: s = "\"newtype\" expected"; break;
+ case 83: s = "\"type\" expected"; break;
+ case 84: s = "\"iterator\" expected"; break;
+ case 85: s = "\"yields\" expected"; break;
+ case 86: s = "\"returns\" expected"; break;
+ case 87: s = "\"method\" expected"; break;
+ case 88: s = "\"colemma\" expected"; break;
+ case 89: s = "\"comethod\" expected"; break;
+ case 90: s = "\"constructor\" expected"; break;
+ case 91: s = "\"free\" expected"; break;
+ case 92: s = "\"ensures\" expected"; break;
+ case 93: s = "\"yield\" expected"; break;
+ case 94: s = "\"`\" expected"; break;
+ case 95: s = "\"label\" expected"; break;
+ case 96: s = "\"break\" expected"; break;
+ case 97: s = "\"where\" expected"; break;
+ case 98: s = "\":=\" expected"; break;
+ case 99: s = "\"return\" expected"; break;
+ case 100: s = "\"new\" expected"; break;
+ case 101: s = "\"if\" expected"; break;
+ case 102: s = "\"while\" expected"; break;
+ case 103: s = "\"match\" expected"; break;
+ case 104: s = "\"assert\" expected"; break;
+ case 105: s = "\"print\" expected"; break;
+ case 106: s = "\"forall\" expected"; break;
+ case 107: s = "\"parallel\" expected"; break;
+ case 108: s = "\"modify\" expected"; break;
+ case 109: s = "\"#\" expected"; break;
+ case 110: s = "\"<=\" expected"; break;
+ case 111: s = "\">=\" expected"; break;
+ case 112: s = "\"\\u2264\" expected"; break;
+ case 113: s = "\"\\u2265\" expected"; break;
+ case 114: s = "\"<==>\" expected"; break;
+ case 115: s = "\"\\u21d4\" expected"; break;
+ case 116: s = "\"==>\" expected"; break;
+ case 117: s = "\"\\u21d2\" expected"; break;
+ case 118: s = "\"<==\" expected"; break;
+ case 119: s = "\"\\u21d0\" expected"; break;
+ case 120: s = "\"&&\" expected"; break;
+ case 121: s = "\"\\u2227\" expected"; break;
+ case 122: s = "\"||\" expected"; break;
+ case 123: s = "\"\\u2228\" expected"; break;
+ case 124: s = "\"!\" expected"; break;
+ case 125: s = "\"\\u00ac\" expected"; break;
+ case 126: s = "\"\\u2200\" expected"; break;
+ case 127: s = "\"exists\" expected"; break;
+ case 128: s = "\"\\u2203\" expected"; break;
+ case 129: s = "\"in\" expected"; break;
+ case 130: s = "\"-\" expected"; break;
+ case 131: s = "\"/\" expected"; break;
+ case 132: s = "\"%\" expected"; break;
+ case 133: s = "\"false\" expected"; break;
+ case 134: s = "\"true\" expected"; break;
+ case 135: s = "\"null\" expected"; break;
+ case 136: s = "\"this\" expected"; break;
+ case 137: s = "\"fresh\" expected"; break;
+ case 138: s = "\"old\" expected"; break;
+ case 139: s = "\"..\" expected"; break;
+ case 140: s = "??? expected"; break;
+ case 141: s = "invalid TopDecl"; break;
+ case 142: s = "invalid DeclModifier"; break;
+ case 143: s = "this symbol not expected in SubModuleDecl"; break;
+ case 144: s = "invalid SubModuleDecl"; break;
+ case 145: s = "this symbol not expected in ClassDecl"; break;
+ case 146: s = "this symbol not expected in DatatypeDecl"; break;
+ case 147: s = "invalid DatatypeDecl"; break;
+ case 148: s = "this symbol not expected in DatatypeDecl"; break;
+ case 149: s = "invalid NewtypeDecl"; break;
+ case 150: s = "invalid OtherTypeDecl"; break;
+ case 151: s = "this symbol not expected in OtherTypeDecl"; break;
+ case 152: s = "this symbol not expected in IteratorDecl"; break;
+ case 153: s = "invalid IteratorDecl"; break;
+ case 154: s = "this symbol not expected in TraitDecl"; break;
+ case 155: s = "invalid ClassMemberDecl"; break;
+ case 156: s = "this symbol not expected in FieldDecl"; break;
+ case 157: s = "invalid FunctionDecl"; break;
+ case 158: s = "invalid FunctionDecl"; break;
+ case 159: s = "invalid FunctionDecl"; break;
+ case 160: s = "invalid FunctionDecl"; break;
+ case 161: s = "invalid FunctionDecl"; break;
+ case 162: s = "this symbol not expected in MethodDecl"; break;
+ case 163: s = "invalid MethodDecl"; break;
+ case 164: s = "invalid MethodDecl"; break;
+ case 165: s = "invalid FIdentType"; break;
+ case 166: s = "this symbol not expected in OldSemi"; break;
+ case 167: s = "invalid TypeIdentOptional"; break;
+ case 168: s = "invalid TypeAndToken"; break;
+ case 169: s = "this symbol not expected in IteratorSpec"; break;
+ case 170: s = "invalid IteratorSpec"; break;
+ case 171: s = "invalid IteratorSpec"; break;
+ case 172: s = "this symbol not expected in MethodSpec"; break;
+ case 173: s = "invalid MethodSpec"; break;
+ case 174: s = "invalid MethodSpec"; break;
+ case 175: s = "invalid FrameExpression"; break;
+ case 176: s = "this symbol not expected in FunctionSpec"; break;
+ case 177: s = "invalid FunctionSpec"; break;
+ case 178: s = "invalid PossiblyWildFrameExpression"; break;
+ case 179: s = "invalid PossiblyWildExpression"; break;
+ case 180: s = "this symbol not expected in OneStmt"; break;
+ case 181: s = "invalid OneStmt"; break;
+ case 182: s = "this symbol not expected in OneStmt"; break;
+ case 183: s = "invalid OneStmt"; break;
+ case 184: s = "invalid AssertStmt"; break;
+ case 185: s = "invalid AssumeStmt"; break;
+ case 186: s = "invalid UpdateStmt"; break;
+ case 187: s = "invalid UpdateStmt"; break;
+ case 188: s = "this symbol not expected in VarDeclStatement"; break;
+ case 189: s = "invalid VarDeclStatement"; break;
+ case 190: s = "invalid VarDeclStatement"; break;
+ case 191: s = "invalid IfStmt"; break;
+ case 192: s = "invalid IfStmt"; break;
+ case 193: s = "invalid WhileStmt"; break;
+ case 194: s = "invalid WhileStmt"; break;
+ case 195: s = "invalid MatchStmt"; break;
+ case 196: s = "invalid ForallStmt"; break;
+ case 197: s = "invalid ForallStmt"; break;
+ case 198: s = "invalid CalcStmt"; break;
+ case 199: s = "invalid ModifyStmt"; break;
+ case 200: s = "this symbol not expected in ModifyStmt"; break;
+ case 201: s = "invalid ModifyStmt"; break;
+ case 202: s = "invalid ReturnStmt"; break;
+ case 203: s = "invalid Rhs"; break;
+ case 204: s = "invalid Lhs"; break;
+ case 205: s = "invalid CasePattern"; break;
+ case 206: s = "invalid AlternativeBlock"; break;
+ case 207: s = "invalid Guard"; break;
+ case 208: s = "this symbol not expected in LoopSpec"; break;
+ case 209: s = "this symbol not expected in LoopSpec"; break;
+ case 210: s = "this symbol not expected in LoopSpec"; break;
+ case 211: s = "invalid LoopSpec"; break;
+ case 212: s = "invalid CaseStatement"; break;
+ case 213: s = "this symbol not expected in CaseStatement"; break;
+ case 214: s = "this symbol not expected in CaseStatement"; break;
+ case 215: s = "invalid CalcOp"; break;
+ case 216: s = "invalid EquivOp"; break;
+ case 217: s = "invalid ImpliesOp"; break;
+ case 218: s = "invalid ExpliesOp"; break;
+ case 219: s = "invalid AndOp"; break;
+ case 220: s = "invalid OrOp"; break;
+ case 221: s = "invalid NegOp"; break;
+ case 222: s = "invalid Forall"; break;
+ case 223: s = "invalid Exists"; break;
+ case 224: s = "invalid QSep"; break;
+ case 225: s = "invalid ImpliesExpliesExpression"; break;
+ case 226: s = "invalid LogicalExpression"; break;
+ case 227: s = "invalid RelOp"; break;
+ case 228: s = "invalid AddOp"; break;
+ case 229: s = "invalid UnaryExpression"; break;
+ case 230: s = "invalid MulOp"; break;
+ case 231: s = "invalid Suffix"; break;
+ case 232: s = "invalid Suffix"; break;
+ case 233: s = "invalid Suffix"; break;
+ case 234: s = "invalid Suffix"; break;
+ case 235: s = "invalid Suffix"; break;
+ case 236: s = "invalid LambdaExpression"; break;
+ case 237: s = "invalid EndlessExpression"; break;
+ case 238: s = "invalid NameSegment"; break;
+ case 239: s = "invalid DisplayExpr"; break;
+ case 240: s = "invalid MultiSetExpr"; break;
+ case 241: s = "invalid ConstAtomExpression"; break;
+ case 242: s = "invalid Nat"; break;
+ case 243: s = "invalid LambdaArrow"; break;
+ case 244: s = "invalid MatchExpression"; break;
+ case 245: s = "invalid QuantifierGuts"; break;
+ case 246: s = "invalid StmtInExpr"; break;
+ case 247: s = "invalid LetExpr"; break;
+ case 248: s = "invalid CaseExpression"; break;
+ case 249: s = "invalid MemberBindingUpdate"; break;
+ case 250: s = "invalid DotSuffix"; break;
default: s = "error " + n; break;
}
return s;
}
- public void SemErr(IToken/*!*/ tok, string/*!*/ msg) { // semantic errors
+ public void SemErr(IToken tok, string msg) { // semantic errors
Contract.Requires(tok != null);
Contract.Requires(msg != null);
- SemErr(tok.filename, tok.line, tok.col, msg);
+ ErrorCount++;
+ Reporting.Error(MessageSource.Parser, tok, msg);
}
- public virtual void SemErr(string filename, int line, int col, string/*!*/ msg) {
+ public void SemErr(string filename, int line, int col, string msg) {
Contract.Requires(msg != null);
- errorStream.WriteLine(errMsgFormat, filename, line, col, msg);
- count++;
+ ErrorCount++;
+ Reporting.Error(MessageSource.Parser, filename, line, col, msg);
}
- public void Warning(IToken/*!*/ tok, string/*!*/ msg) { // warnings
+ public void Warning(IToken tok, string msg) {
Contract.Requires(tok != null);
Contract.Requires(msg != null);
- Warning(tok.filename, tok.line, tok.col, msg);
- }
-
- public virtual void Warning(string filename, int line, int col, string msg) {
- Contract.Requires(msg != null);
- errorStream.WriteLine(warningMsgFormat, filename, line, col, msg);
+ Reporting.Warning(MessageSource.Parser, tok, msg);
}
} // Errors
@@ -4602,6 +5020,4 @@ public class Errors {
public class FatalError: Exception {
public FatalError(string m): base(m) {}
}
-
-
} \ No newline at end of file