public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
			throw new global::System.NotImplementedException("IfElseStatement");
		}
Пример #2
0
		public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
			Debug.Assert((ifElseStatement != null));
			Debug.Assert((ifElseStatement.Condition != null));
			Debug.Assert((ifElseStatement.TrueStatement != null));
			Debug.Assert((ifElseStatement.FalseStatement != null));
			Debug.Assert((ifElseStatement.ElseIfSections != null));
			ifElseStatement.Condition.AcceptVisitor(this, data);
			foreach (Statement o in ifElseStatement.TrueStatement) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			foreach (Statement o in ifElseStatement.FalseStatement) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			foreach (ElseIfSection o in ifElseStatement.ElseIfSections) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return null;
		}
Пример #3
0
		public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
			Debug.Assert((ifElseStatement != null));
			Debug.Assert((ifElseStatement.Condition != null));
			Debug.Assert((ifElseStatement.TrueStatement != null));
			Debug.Assert((ifElseStatement.FalseStatement != null));
			Debug.Assert((ifElseStatement.ElseIfSections != null));
			nodeStack.Push(ifElseStatement.Condition);
			ifElseStatement.Condition.AcceptVisitor(this, data);
			ifElseStatement.Condition = ((Expression)(nodeStack.Pop()));
			for (int i = 0; i < ifElseStatement.TrueStatement.Count; i++) {
				Statement o = ifElseStatement.TrueStatement[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (Statement)nodeStack.Pop();
				if (o == null)
					ifElseStatement.TrueStatement.RemoveAt(i--);
				else
					ifElseStatement.TrueStatement[i] = o;
			}
			for (int i = 0; i < ifElseStatement.FalseStatement.Count; i++) {
				Statement o = ifElseStatement.FalseStatement[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (Statement)nodeStack.Pop();
				if (o == null)
					ifElseStatement.FalseStatement.RemoveAt(i--);
				else
					ifElseStatement.FalseStatement[i] = o;
			}
			for (int i = 0; i < ifElseStatement.ElseIfSections.Count; i++) {
				ElseIfSection o = ifElseStatement.ElseIfSections[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (ElseIfSection)nodeStack.Pop();
				if (o == null)
					ifElseStatement.ElseIfSections.RemoveAt(i--);
				else
					ifElseStatement.ElseIfSections[i] = o;
			}
			return null;
		}
Пример #4
0
	void IfStatement(out Statement statement) {
		Expression expr = null; Statement embeddedStatement; statement = null;
		Expect(135);
		Location ifStartLocation = t.Location;
		Expr(out expr);
		if (la.kind == 214) {
			Get();
		}
		if (la.kind == 1 || la.kind == 21) {
			EndOfStmt();
			Block(out embeddedStatement);
			IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement);
				ifStatement.StartLocation = ifStartLocation;
				Location elseIfStart;

			while (la.kind == 112 || (IsElseIf())) {
				if (IsElseIf()) {
					Expect(111);
					elseIfStart = t.Location;
					Expect(135);
				} else {
					Get();
					elseIfStart = t.Location;
				}
				Expression condition = null; Statement block = null;
				Expr(out condition);
				if (la.kind == 214) {
					Get();
				}
				EndOfStmt();
				Block(out block);
				ElseIfSection elseIfSection = new ElseIfSection(condition, block);
					elseIfSection.StartLocation = elseIfStart;
					elseIfSection.EndLocation = t.Location;
					elseIfSection.Parent = ifStatement;
					ifStatement.ElseIfSections.Add(elseIfSection);

			}
			if (la.kind == 111) {
				Get();
				if (la.kind == 1 || la.kind == 21) {
					EndOfStmt();
				}
				Block(out embeddedStatement);
				ifStatement.FalseStatement.Add(embeddedStatement);

			}
			Expect(113);
			Expect(135);
			ifStatement.EndLocation = t.Location;
				statement = ifStatement;

		} else if (StartOf(44)) {
			IfElseStatement ifStatement = new IfElseStatement(expr);
				ifStatement.StartLocation = ifStartLocation;

			SingleLineStatementList(ifStatement.TrueStatement);
			if (la.kind == 111) {
				Get();
				if (StartOf(44)) {
					SingleLineStatementList(ifStatement.FalseStatement);
				}
			}
			ifStatement.EndLocation = t.Location; statement = ifStatement;
		} else SynErr(310);
	}
Пример #5
0
		public virtual object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
			return base.VisitIfElseStatement(ifElseStatement, data);
		}
Пример #6
0
		public sealed override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
			this.BeginVisit(ifElseStatement);
			object result = this.TrackedVisitIfElseStatement(ifElseStatement, data);
			this.EndVisit(ifElseStatement);
			return result;
		}
Пример #7
0
		public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data)
		{
			CodeConditionStatement ifStmt = new CodeConditionStatement();
			
			ifStmt.Condition = (CodeExpression)ifElseStatement.Condition.AcceptVisitor(this, data);
			
			codeStack.Push(ifStmt.TrueStatements);
			foreach (Statement stmt in ifElseStatement.TrueStatement) {
				if (stmt is BlockStatement) {
					stmt.AcceptChildren(this, data);
				} else {
					stmt.AcceptVisitor(this, data);
				}
			}
			codeStack.Pop();
			
			codeStack.Push(ifStmt.FalseStatements);
			foreach (Statement stmt in ifElseStatement.FalseStatement) {
				if (stmt is BlockStatement) {
					stmt.AcceptChildren(this, data);
				} else {
					stmt.AcceptVisitor(this, data);
				}
			}
			codeStack.Pop();
			
			AddStmt(ifStmt);
			
			return ifStmt;
		}