summaryrefslogtreecommitdiff
path: root/Source/Dafny/Dafny.atg
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2015-07-16 15:42:08 -0700
committerGravatar Rustan Leino <unknown>2015-07-16 15:42:08 -0700
commit61a5be0930c43694d270809ed5550c74b6e59e5d (patch)
tree96875269a7421cd918f24b37c6f4759cd6f684c6 /Source/Dafny/Dafny.atg
parent2e93ec8ece4d029809bf092c779756e0b18d7a6c (diff)
parent8f18456b7e89412855abc9993447512bdb835da9 (diff)
Merge
Diffstat (limited to 'Source/Dafny/Dafny.atg')
-rw-r--r--Source/Dafny/Dafny.atg14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/Dafny/Dafny.atg b/Source/Dafny/Dafny.atg
index 6e939968..f30542d0 100644
--- a/Source/Dafny/Dafny.atg
+++ b/Source/Dafny/Dafny.atg
@@ -299,6 +299,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;
@@ -306,6 +309,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)) {
@@ -343,7 +350,7 @@ bool IsType(ref IToken pt) {
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
@@ -362,6 +369,11 @@ 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;