コード例 #1
0
		public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			Debug.Assert((fixedStatement != null));
			Debug.Assert((fixedStatement.PointerDeclaration != null));
			Debug.Assert((fixedStatement.EmbeddedStatement != null));
			fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
			return fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
		}
コード例 #2
0
ファイル: Parser.cs プロジェクト: yayanyang/monodevelop
	void EmbeddedStatement(
#line  1550 "Frames/cs.ATG" 
out Statement statement) {

#line  1552 "Frames/cs.ATG" 
		TypeReference type = null;
		Expression expr = null;
		Statement embeddedStatement = null;
		statement = null;
		

#line  1558 "Frames/cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 16) {
			Block(
#line  1560 "Frames/cs.ATG" 
out statement);
		} else if (la.kind == 11) {
			lexer.NextToken();

#line  1563 "Frames/cs.ATG" 
			statement = new EmptyStatement(); 
		} else if (
#line  1566 "Frames/cs.ATG" 
UnCheckedAndLBrace()) {

#line  1566 "Frames/cs.ATG" 
			Statement block; bool isChecked = true; 
			if (la.kind == 58) {
				lexer.NextToken();
			} else if (la.kind == 118) {
				lexer.NextToken();

#line  1567 "Frames/cs.ATG" 
				isChecked = false;
			} else SynErr(197);
			Block(
#line  1568 "Frames/cs.ATG" 
out block);

#line  1568 "Frames/cs.ATG" 
			statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); 
		} else if (la.kind == 79) {
			IfStatement(
#line  1571 "Frames/cs.ATG" 
out statement);
		} else if (la.kind == 110) {
			lexer.NextToken();

#line  1573 "Frames/cs.ATG" 
			List<SwitchSection> switchSections = new List<SwitchSection>(); 
			Expect(20);
			Expr(
#line  1574 "Frames/cs.ATG" 
out expr);
			Expect(21);
			Expect(16);
			SwitchSections(
#line  1575 "Frames/cs.ATG" 
switchSections);
			Expect(17);

#line  1577 "Frames/cs.ATG" 
			statement = new SwitchStatement(expr, switchSections); 
		} else if (la.kind == 125) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1580 "Frames/cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1581 "Frames/cs.ATG" 
out embeddedStatement);

#line  1582 "Frames/cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
		} else if (la.kind == 65) {
			lexer.NextToken();
			EmbeddedStatement(
#line  1584 "Frames/cs.ATG" 
out embeddedStatement);
			Expect(125);
			Expect(20);
			Expr(
#line  1585 "Frames/cs.ATG" 
out expr);
			Expect(21);
			Expect(11);

#line  1586 "Frames/cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); 
		} else if (la.kind == 76) {
			lexer.NextToken();

#line  1588 "Frames/cs.ATG" 
			List<Statement> initializer = null; List<Statement> iterator = null; 
			Expect(20);
			if (StartOf(6)) {
				ForInitializer(
#line  1589 "Frames/cs.ATG" 
out initializer);
			}
			Expect(11);
			if (StartOf(6)) {
				Expr(
#line  1590 "Frames/cs.ATG" 
out expr);
			}
			Expect(11);
			if (StartOf(6)) {
				ForIterator(
#line  1591 "Frames/cs.ATG" 
out iterator);
			}
			Expect(21);
			EmbeddedStatement(
#line  1592 "Frames/cs.ATG" 
out embeddedStatement);

#line  1593 "Frames/cs.ATG" 
			statement = new ForStatement(initializer, expr, iterator, embeddedStatement); 
		} else if (la.kind == 77) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1595 "Frames/cs.ATG" 
out type);
			Identifier();

#line  1595 "Frames/cs.ATG" 
			string varName = t.val; 
			Expect(81);
			Expr(
#line  1596 "Frames/cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1597 "Frames/cs.ATG" 
out embeddedStatement);

#line  1598 "Frames/cs.ATG" 
			statement = new ForeachStatement(type, varName , expr, embeddedStatement); 
		} else if (la.kind == 53) {
			lexer.NextToken();
			Expect(11);

#line  1601 "Frames/cs.ATG" 
			statement = new BreakStatement(); 
		} else if (la.kind == 61) {
			lexer.NextToken();
			Expect(11);

#line  1602 "Frames/cs.ATG" 
			statement = new ContinueStatement(); 
		} else if (la.kind == 78) {
			GotoStatement(
#line  1603 "Frames/cs.ATG" 
out statement);
		} else if (
#line  1605 "Frames/cs.ATG" 
IsYieldStatement()) {
			Expect(132);
			if (la.kind == 101) {
				lexer.NextToken();
				Expr(
#line  1606 "Frames/cs.ATG" 
out expr);

#line  1606 "Frames/cs.ATG" 
				statement = new YieldStatement(new ReturnStatement(expr)); 
			} else if (la.kind == 53) {
				lexer.NextToken();

#line  1607 "Frames/cs.ATG" 
				statement = new YieldStatement(new BreakStatement()); 
			} else SynErr(198);
			Expect(11);
		} else if (la.kind == 101) {
			lexer.NextToken();
			if (StartOf(6)) {
				Expr(
#line  1610 "Frames/cs.ATG" 
out expr);
			}
			Expect(11);

#line  1610 "Frames/cs.ATG" 
			statement = new ReturnStatement(expr); 
		} else if (la.kind == 112) {
			lexer.NextToken();
			if (StartOf(6)) {
				Expr(
#line  1611 "Frames/cs.ATG" 
out expr);
			}
			Expect(11);

#line  1611 "Frames/cs.ATG" 
			statement = new ThrowStatement(expr); 
		} else if (StartOf(6)) {
			StatementExpr(
#line  1614 "Frames/cs.ATG" 
out statement);
			while (!(la.kind == 0 || la.kind == 11)) {SynErr(199); lexer.NextToken(); }
			Expect(11);
		} else if (la.kind == 114) {
			TryStatement(
#line  1617 "Frames/cs.ATG" 
out statement);
		} else if (la.kind == 86) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1620 "Frames/cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1621 "Frames/cs.ATG" 
out embeddedStatement);

#line  1621 "Frames/cs.ATG" 
			statement = new LockStatement(expr, embeddedStatement); 
		} else if (la.kind == 121) {

#line  1624 "Frames/cs.ATG" 
			Statement resourceAcquisitionStmt = null; 
			lexer.NextToken();
			Expect(20);
			ResourceAcquisition(
#line  1626 "Frames/cs.ATG" 
out resourceAcquisitionStmt);
			Expect(21);
			EmbeddedStatement(
#line  1627 "Frames/cs.ATG" 
out embeddedStatement);

#line  1627 "Frames/cs.ATG" 
			statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); 
		} else if (la.kind == 119) {
			lexer.NextToken();
			Block(
#line  1630 "Frames/cs.ATG" 
out embeddedStatement);

#line  1630 "Frames/cs.ATG" 
			statement = new UnsafeStatement(embeddedStatement); 
		} else if (la.kind == 74) {

#line  1632 "Frames/cs.ATG" 
			Statement pointerDeclarationStmt = null; 
			lexer.NextToken();
			Expect(20);
			ResourceAcquisition(
#line  1634 "Frames/cs.ATG" 
out pointerDeclarationStmt);
			Expect(21);
			EmbeddedStatement(
#line  1635 "Frames/cs.ATG" 
out embeddedStatement);

#line  1635 "Frames/cs.ATG" 
			statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement); 
		} else SynErr(200);

#line  1637 "Frames/cs.ATG" 
		if (statement != null) {
		statement.StartLocation = startLocation;
		statement.EndLocation = t.EndLocation;
		}
		
	}
コード例 #3
0
		public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
		{
			// uses LocalVariableDeclaration, we just have to put the end location on the stack
			if (fixedStatement.EmbeddedStatement.EndLocation.IsEmpty) {
				return base.VisitFixedStatement(fixedStatement, data);
			} else {
				endLocationStack.Push(fixedStatement.EmbeddedStatement.EndLocation);
				base.VisitFixedStatement(fixedStatement, data);
				endLocationStack.Pop();
				return null;
			}
		}
コード例 #4
0
		public sealed override object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			this.BeginVisit(fixedStatement);
			object result = this.TrackedVisitFixedStatement(fixedStatement, data);
			this.EndVisit(fixedStatement);
			return result;
		}
コード例 #5
0
		public virtual object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data) {
			return base.VisitFixedStatement(fixedStatement, data);
		}
コード例 #6
0
		public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			Debug.Assert((fixedStatement != null));
			Debug.Assert((fixedStatement.PointerDeclaration != null));
			Debug.Assert((fixedStatement.EmbeddedStatement != null));
			nodeStack.Push(fixedStatement.PointerDeclaration);
			fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
			fixedStatement.PointerDeclaration = ((Statement)(nodeStack.Pop()));
			nodeStack.Push(fixedStatement.EmbeddedStatement);
			fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
			fixedStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
			return null;
		}
コード例 #7
0
		public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			throw new global::System.NotImplementedException("FixedStatement");
		}
コード例 #8
0
		public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
		{
			throw new NotSupportedException("CodeDom does not support Fixed Statement");
		}