public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
			throw new global::System.NotImplementedException("ForNextStatement");
		}
Exemplo n.º 2
0
		public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
			Debug.Assert((forNextStatement != null));
			Debug.Assert((forNextStatement.Start != null));
			Debug.Assert((forNextStatement.End != null));
			Debug.Assert((forNextStatement.Step != null));
			Debug.Assert((forNextStatement.NextExpressions != null));
			Debug.Assert((forNextStatement.TypeReference != null));
			Debug.Assert((forNextStatement.LoopVariableExpression != null));
			Debug.Assert((forNextStatement.EmbeddedStatement != null));
			forNextStatement.Start.AcceptVisitor(this, data);
			forNextStatement.End.AcceptVisitor(this, data);
			forNextStatement.Step.AcceptVisitor(this, data);
			foreach (Expression o in forNextStatement.NextExpressions) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			forNextStatement.TypeReference.AcceptVisitor(this, data);
			forNextStatement.LoopVariableExpression.AcceptVisitor(this, data);
			return forNextStatement.EmbeddedStatement.AcceptVisitor(this, data);
		}
Exemplo n.º 3
0
		public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
			Debug.Assert((forNextStatement != null));
			Debug.Assert((forNextStatement.Start != null));
			Debug.Assert((forNextStatement.End != null));
			Debug.Assert((forNextStatement.Step != null));
			Debug.Assert((forNextStatement.NextExpressions != null));
			Debug.Assert((forNextStatement.TypeReference != null));
			Debug.Assert((forNextStatement.LoopVariableExpression != null));
			Debug.Assert((forNextStatement.EmbeddedStatement != null));
			nodeStack.Push(forNextStatement.Start);
			forNextStatement.Start.AcceptVisitor(this, data);
			forNextStatement.Start = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(forNextStatement.End);
			forNextStatement.End.AcceptVisitor(this, data);
			forNextStatement.End = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(forNextStatement.Step);
			forNextStatement.Step.AcceptVisitor(this, data);
			forNextStatement.Step = ((Expression)(nodeStack.Pop()));
			for (int i = 0; i < forNextStatement.NextExpressions.Count; i++) {
				Expression o = forNextStatement.NextExpressions[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (Expression)nodeStack.Pop();
				if (o == null)
					forNextStatement.NextExpressions.RemoveAt(i--);
				else
					forNextStatement.NextExpressions[i] = o;
			}
			nodeStack.Push(forNextStatement.TypeReference);
			forNextStatement.TypeReference.AcceptVisitor(this, data);
			forNextStatement.TypeReference = ((TypeReference)(nodeStack.Pop()));
			nodeStack.Push(forNextStatement.LoopVariableExpression);
			forNextStatement.LoopVariableExpression.AcceptVisitor(this, data);
			forNextStatement.LoopVariableExpression = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(forNextStatement.EmbeddedStatement);
			forNextStatement.EmbeddedStatement.AcceptVisitor(this, data);
			forNextStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
			return null;
		}
Exemplo n.º 4
0
	void ForStatement(out Statement statement) {
		Expression expr = null; Statement embeddedStatement; statement = null; Location startLocation = la.Location;
		Expect(124);
		Expression group = null;
				TypeReference typeReference;
				string        typeName;

		if (la.kind == 110) {
			Get();
			LoopControlVariable(out typeReference, out typeName);
			Expect(138);
			Expr(out group);
			EndOfStmt();
			Block(out embeddedStatement);
			Expect(163);
			if (StartOf(24)) {
				Expr(out expr);
			}
			statement = new ForeachStatement(typeReference, 
				                                 typeName,
				                                 group, 
				                                 embeddedStatement, 
				                                 expr);
				statement.StartLocation = startLocation;
				statement.EndLocation   = t.EndLocation;
				

		} else if (StartOf(42)) {
			Expression start = null;
				Expression end = null;
				Expression step = null;
				Expression variableExpr = null;
				Expression nextExpr = null;
				List<Expression> nextExpressions = null;

			if (IsLoopVariableDeclaration()) {
				LoopControlVariable(out typeReference, out typeName);
			} else {
				typeReference = null; typeName = null;
				SimpleExpr(out variableExpr);
			}
			Expect(20);
			Expr(out start);
			Expect(216);
			Expr(out end);
			if (la.kind == 205) {
				Get();
				Expr(out step);
			}
			EndOfStmt();
			Block(out embeddedStatement);
			Expect(163);
			if (StartOf(24)) {
				Expr(out nextExpr);
				nextExpressions = new List<Expression>();
					nextExpressions.Add(nextExpr);

				while (la.kind == 22) {
					Get();
					Expr(out nextExpr);
					nextExpressions.Add(nextExpr);
				}
			}
			statement = new ForNextStatement {
					TypeReference = typeReference,
					VariableName = typeName, 
					LoopVariableExpression = variableExpr,
					Start = start, 
					End = end, 
					Step = step, 
					EmbeddedStatement = embeddedStatement, 
					NextExpressions = nextExpressions
				};

		} else SynErr(309);
	}
Exemplo n.º 5
0
		public override object VisitForNextStatement(ForNextStatement forNextStatement, object data)
		{
			if (forNextStatement.EmbeddedStatement.EndLocation.IsEmpty) {
				return base.VisitForNextStatement(forNextStatement, data);
			} else {
				endLocationStack.Push(forNextStatement.EmbeddedStatement.EndLocation);
				AddVariable(forNextStatement.TypeReference,
				            forNextStatement.VariableName,
				            forNextStatement.StartLocation,
				            forNextStatement.EndLocation,
				            false, false,
				            forNextStatement.Start,
				            null,
				            false);
				
				base.VisitForNextStatement(forNextStatement, data);
				
				endLocationStack.Pop();
				return null;
			}
		}
Exemplo n.º 6
0
		public virtual object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data) {
			return base.VisitForNextStatement(forNextStatement, data);
		}
Exemplo n.º 7
0
		public sealed override object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
			this.BeginVisit(forNextStatement);
			object result = this.TrackedVisitForNextStatement(forNextStatement, data);
			this.EndVisit(forNextStatement);
			return result;
		}