summaryrefslogtreecommitdiff
path: root/Source/Dafny/Parser.cs
diff options
context:
space:
mode:
authorGravatar Nadia Polikarpova <nadia.polikarpova@gmail.com>2013-07-31 15:05:55 +0200
committerGravatar Nadia Polikarpova <nadia.polikarpova@gmail.com>2013-07-31 15:05:55 +0200
commit226c4272911d9e1473a8b541917adde9cba9b6bc (patch)
tree16b747e7a0fe7c7158acea8392915568b599fc80 /Source/Dafny/Parser.cs
parentefcbed91308c9f585a6e5c8fc807e069d291ed0c (diff)
Regenerated Parser after a merge.
Diffstat (limited to 'Source/Dafny/Parser.cs')
-rw-r--r--Source/Dafny/Parser.cs57
1 files changed, 28 insertions, 29 deletions
diff --git a/Source/Dafny/Parser.cs b/Source/Dafny/Parser.cs
index 315ad1b7..05de87b6 100644
--- a/Source/Dafny/Parser.cs
+++ b/Source/Dafny/Parser.cs
@@ -1915,32 +1915,32 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
Expect(7);
- if (StartOf(15)) {
+ while (StartOf(15)) {
Expression(out e);
lines.Add(e); stepOp = calcOp;
Expect(20);
- while (StartOf(21)) {
- if (StartOf(20)) {
- CalcOp(out opTok, out op);
- maybeOp = resOp.ResultOp(op);
- if (maybeOp == null) {
- SemErr(opTok, "this operator cannot continue this calculation");
- } else {
- stepOp = op;
- resOp = maybeOp;
- }
-
+ if (StartOf(20)) {
+ CalcOp(out opTok, out op);
+ maybeOp = resOp.ResultOp(op);
+ if (maybeOp == null) {
+ SemErr(opTok, "this operator cannot continue this calculation");
+ } else {
+ stepOp = op;
+ resOp = maybeOp;
}
- stepOps.Add(stepOp);
- Hint(out h);
- hints.Add(h);
- Expression(out e);
- lines.Add(e); stepOp = calcOp;
- Expect(20);
+
}
+ stepOps.Add(stepOp);
+ Hint(out h);
+ hints.Add(h);
}
Expect(8);
+ if (lines.Count > 0) {
+ // Repeat the last line to create a dummy line for the dangling hint
+ lines.Add(lines[lines.Count - 1]);
+ }
s = new CalcStmt(x, calcOp, lines, hints, stepOps, resOp);
+
}
void ReturnStmt(out Statement/*!*/ s) {
@@ -1956,7 +1956,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Get();
returnTok = t; isYield = true;
} else SynErr(183);
- if (StartOf(22)) {
+ if (StartOf(21)) {
Rhs(out r, null);
rhss = new List<AssignmentRhs>(); rhss.Add(r);
while (la.kind == 29) {
@@ -2071,7 +2071,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
while (la.kind == 21 || la.kind == 69) {
Suffix(ref e);
}
- } else if (StartOf(23)) {
+ } else if (StartOf(22)) {
ConstAtomExpression(out e);
Suffix(ref e);
while (la.kind == 21 || la.kind == 69) {
@@ -2135,7 +2135,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
decreases = new List<Expression/*!*/>();
mod = null;
- while (StartOf(24)) {
+ while (StartOf(23)) {
if (la.kind == 43 || la.kind == 76) {
Invariant(out invariant);
while (!(la.kind == 0 || la.kind == 20)) {SynErr(187); Get();}
@@ -2389,7 +2389,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
void ImpliesExpliesExpression(out Expression/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expression/*!*/ e1;
LogicalExpression(out e0);
- if (StartOf(25)) {
+ if (StartOf(24)) {
if (la.kind == 92 || la.kind == 93) {
ImpliesOp();
x = t;
@@ -2413,7 +2413,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
void LogicalExpression(out Expression/*!*/ e0) {
Contract.Ensures(Contract.ValueAtReturn(out e0) != null); IToken/*!*/ x; Expression/*!*/ e1;
RelationalExpression(out e0);
- if (StartOf(26)) {
+ if (StartOf(25)) {
if (la.kind == 96 || la.kind == 97) {
AndOp();
x = t;
@@ -2467,7 +2467,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Term(out e0);
e = e0;
- if (StartOf(27)) {
+ if (StartOf(26)) {
RelOp(out x, out op, out k);
firstOpTok = x;
Term(out e1);
@@ -2480,7 +2480,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
e = new TernaryExpr(x, op == BinaryExpr.Opcode.Eq ? TernaryExpr.Opcode.PrefixEqOp : TernaryExpr.Opcode.PrefixNeqOp, k, e0, e1);
}
- while (StartOf(27)) {
+ while (StartOf(26)) {
if (chain == null) {
chain = new List<Expression>();
ops = new List<BinaryExpr.Opcode>();
@@ -2747,7 +2747,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
}
} else if (la.kind == 1) {
MapComprehensionExpr(x, out e);
- } else if (StartOf(28)) {
+ } else if (StartOf(27)) {
SemErr("map must be followed by literal in brackets or comprehension.");
} else SynErr(202);
break;
@@ -3019,7 +3019,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expression(out e);
e = new MultiSetFormingExpr(x, e);
Expect(32);
- } else if (StartOf(29)) {
+ } else if (StartOf(28)) {
SemErr("multiset must be followed by multiset literal or expression to coerce in parentheses.");
} else SynErr(211);
}
@@ -3340,7 +3340,7 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
Expect(6);
Expect(1);
aName = t.val;
- if (StartOf(30)) {
+ if (StartOf(29)) {
AttributeArg(out aArg);
aArgs.Add(aArg);
while (la.kind == 29) {
@@ -3386,7 +3386,6 @@ List<Expression/*!*/>/*!*/ decreases, ref Attributes decAttrs, ref Attributes mo
{x,T,T,T, x,x,x,T, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,T, x,x,x,x, x,T,x,x, x,x,x,T, x,T,x,T, x,x,x,x, x,T,T,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, x,x,T,T, T,T,T,T, T,x,x,T, T,T,x,x, x,x},
{x,T,T,T, x,x,x,T, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,T, x,x,x,x, x,T,x,x, x,x,x,T, x,T,x,T, x,x,x,x, x,T,T,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, x,x,T,T, T,T,T,T, T,x,x,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,T, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},
- {x,T,T,T, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,T, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,T, x,x,x,x, x,T,x,x, x,x,x,T, x,T,x,T, x,x,x,x, x,T,T,x, T,x,T,x, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,x, x,T,x,T, x,x,T,T, T,T,T,T, T,x,x,T, T,T,x,x, x,x},
{x,T,T,T, x,x,x,T, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,T, x,x,x,x, x,T,x,x, x,x,x,T, T,T,x,T, x,x,x,x, x,T,T,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, x,x,T,T, T,T,T,T, T,x,x,T, T,T,x,x, x,x},
{x,x,T,T, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,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,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x},