public override object Visit(SwitchStatement switchStatement, object data)
 {
     throw new NotSupportedException("CodeDom does not support Switch Statement");
 }
        public override object Visit(SwitchStatement switchStatement, object data)
        {
            DebugOutput(switchStatement);
            AppendIndentation();sourceText.Append("Select ");
            sourceText.Append(switchStatement.SwitchExpression.AcceptVisitor(this, data).ToString());
            AppendNewLine();
            foreach (SwitchSection section in switchStatement.SwitchSections) {
                AppendIndentation();sourceText.Append("Case ");

                for (int i = 0; i < section.SwitchLabels.Count; ++i) {
                    Expression label = (Expression)section.SwitchLabels[i];
                    if (label == null) {
                        sourceText.Append("Else");
                        continue;
                    }
                    sourceText.Append(label.AcceptVisitor(this, data));
                    if (i + 1 < section.SwitchLabels.Count) {
                        sourceText.Append(", ");
                    }
                }
                AppendNewLine();

                ++indentLevel;
                section.AcceptVisitor(this, data);
                --indentLevel;
            }
            AppendIndentation();sourceText.Append("End Select ");
            AppendNewLine();
            return null;
        }
 public override object Visit(SwitchStatement switchStatement, object data)
 {
     Console.WriteLine(switchStatement.ToString());
     return switchStatement.AcceptChildren(this, data);
 }
 public virtual object Visit(SwitchStatement switchStatement, object data)
 {
     if (switchStatement == null) {
         return null;
     }
     if (switchStatement.SwitchExpression != null) {
         switchStatement.SwitchExpression.AcceptVisitor(this, data);
     }
     foreach (SwitchSection section in switchStatement.SwitchSections) {
         section.AcceptVisitor(this, data);
     }
     return data;
 }
	void EmbeddedStatement(
#line  1564 "cs.ATG" 
out Statement statement) {

#line  1566 "cs.ATG" 
		TypeReference type = null;
		Expression expr = null;
		Statement embeddedStatement = null;
		statement = null;
		
		if (la.kind == 14) {
			Block(
#line  1572 "cs.ATG" 
out statement);
		} else if (la.kind == 10) {
			lexer.NextToken();

#line  1574 "cs.ATG" 
			statement = new EmptyStatement(); 
		} else if (
#line  1576 "cs.ATG" 
IdentIsYield ()) {
			Expect(1);
			if (la.kind == 100) {
				lexer.NextToken();
				Expr(
#line  1577 "cs.ATG" 
out expr);
			} else if (la.kind == 52) {
				lexer.NextToken();
			} else SynErr(169);
			Expect(10);

#line  1577 "cs.ATG" 
			statement = new YieldStatement(expr); 
		} else if (
#line  1579 "cs.ATG" 
UnCheckedAndLBrace()) {

#line  1579 "cs.ATG" 
			Statement block; bool isChecked = true; 
			if (la.kind == 57) {
				lexer.NextToken();
			} else if (la.kind == 117) {
				lexer.NextToken();

#line  1580 "cs.ATG" 
				isChecked = false;
			} else SynErr(170);
			Block(
#line  1581 "cs.ATG" 
out block);

#line  1581 "cs.ATG" 
			statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); 
		} else if (StartOf(4)) {
			StatementExpr(
#line  1583 "cs.ATG" 
out statement);
			Expect(10);
		} else if (la.kind == 78) {
			lexer.NextToken();

#line  1585 "cs.ATG" 
			Statement elseStatement = null; 
			Expect(18);
			Expr(
#line  1586 "cs.ATG" 
out expr);
			Expect(19);
			EmbeddedStatement(
#line  1587 "cs.ATG" 
out embeddedStatement);
			if (la.kind == 66) {
				lexer.NextToken();
				EmbeddedStatement(
#line  1588 "cs.ATG" 
out elseStatement);
			}

#line  1589 "cs.ATG" 
			statement = elseStatement != null ? (Statement)new IfElseStatement(expr, embeddedStatement, elseStatement) :  (Statement)new IfStatement(expr, embeddedStatement); 
		} else if (la.kind == 109) {
			lexer.NextToken();

#line  1590 "cs.ATG" 
			ArrayList switchSections = new ArrayList(); 
			Expect(18);
			Expr(
#line  1591 "cs.ATG" 
out expr);
			Expect(19);
			Expect(14);
			while (la.kind == 54 || la.kind == 62) {
				SwitchSection(
#line  1592 "cs.ATG" 
out statement);

#line  1592 "cs.ATG" 
				switchSections.Add(statement); 
			}
			Expect(15);

#line  1593 "cs.ATG" 
			statement = new SwitchStatement(expr, switchSections); 
		} else if (la.kind == 124) {
			lexer.NextToken();
			Expect(18);
			Expr(
#line  1595 "cs.ATG" 
out expr);
			Expect(19);
			EmbeddedStatement(
#line  1596 "cs.ATG" 
out embeddedStatement);

#line  1596 "cs.ATG" 
			statement = new WhileStatement(expr, embeddedStatement); 
		} else if (la.kind == 64) {
			lexer.NextToken();
			EmbeddedStatement(
#line  1597 "cs.ATG" 
out embeddedStatement);
			Expect(124);
			Expect(18);
			Expr(
#line  1598 "cs.ATG" 
out expr);
			Expect(19);
			Expect(10);

#line  1598 "cs.ATG" 
			statement = new DoWhileStatement(expr, embeddedStatement); 
		} else if (la.kind == 75) {
			lexer.NextToken();

#line  1599 "cs.ATG" 
			ArrayList initializer = null, iterator = null; 
			Expect(18);
			if (StartOf(4)) {
				ForInitializer(
#line  1600 "cs.ATG" 
out initializer);
			}
			Expect(10);
			if (StartOf(4)) {
				Expr(
#line  1601 "cs.ATG" 
out expr);
			}
			Expect(10);
			if (StartOf(4)) {
				ForIterator(
#line  1602 "cs.ATG" 
out iterator);
			}
			Expect(19);
			EmbeddedStatement(
#line  1603 "cs.ATG" 
out embeddedStatement);

#line  1603 "cs.ATG" 
			statement = new ForStatement(initializer, expr, iterator, embeddedStatement); 
		} else if (la.kind == 76) {
			lexer.NextToken();
			Expect(18);
			Type(
#line  1604 "cs.ATG" 
out type);
			Expect(1);

#line  1604 "cs.ATG" 
			string varName = t.val; 
			Expect(80);
			Expr(
#line  1605 "cs.ATG" 
out expr);
			Expect(19);
			EmbeddedStatement(
#line  1606 "cs.ATG" 
out embeddedStatement);

#line  1606 "cs.ATG" 
			statement = new ForeachStatement(type, varName , expr, embeddedStatement); 
			statement.EndLocation = t.EndLocation;
			
		} else if (la.kind == 52) {
			lexer.NextToken();
			Expect(10);

#line  1610 "cs.ATG" 
			statement = new BreakStatement(); 
		} else if (la.kind == 60) {
			lexer.NextToken();
			Expect(10);

#line  1611 "cs.ATG" 
			statement = new ContinueStatement(); 
		} else if (la.kind == 77) {
			GotoStatement(
#line  1612 "cs.ATG" 
out statement);
		} else if (la.kind == 100) {
			lexer.NextToken();
			if (StartOf(4)) {
				Expr(
#line  1613 "cs.ATG" 
out expr);
			}
			Expect(10);

#line  1613 "cs.ATG" 
			statement = new ReturnStatement(expr); 
		} else if (la.kind == 111) {
			lexer.NextToken();
			if (StartOf(4)) {
				Expr(
#line  1614 "cs.ATG" 
out expr);
			}
			Expect(10);

#line  1614 "cs.ATG" 
			statement = new ThrowStatement(expr); 
		} else if (la.kind == 113) {
			TryStatement(
#line  1617 "cs.ATG" 
out statement);
		} else if (la.kind == 85) {
			lexer.NextToken();
			Expect(18);
			Expr(
#line  1619 "cs.ATG" 
out expr);
			Expect(19);
			EmbeddedStatement(
#line  1620 "cs.ATG" 
out embeddedStatement);

#line  1620 "cs.ATG" 
			statement = new LockStatement(expr, embeddedStatement); 
		} else if (la.kind == 120) {

#line  1622 "cs.ATG" 
			Statement resourceAcquisitionStmt = null; 
			lexer.NextToken();
			Expect(18);
			ResourceAcquisition(
#line  1624 "cs.ATG" 
out resourceAcquisitionStmt);
			Expect(19);
			EmbeddedStatement(
#line  1625 "cs.ATG" 
out embeddedStatement);

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

#line  1627 "cs.ATG" 
			statement = new UnsafeStatement(embeddedStatement); 
		} else if (la.kind == 73) {
			lexer.NextToken();
			Expect(18);
			Type(
#line  1630 "cs.ATG" 
out type);

#line  1630 "cs.ATG" 
			if (type.PointerNestingLevel == 0) Error("can only fix pointer types");
			FixedStatement fxStmt = new FixedStatement(type);
			string identifier = null;
			
			Expect(1);

#line  1634 "cs.ATG" 
			identifier = t.val; 
			Expect(3);
			Expr(
#line  1635 "cs.ATG" 
out expr);

#line  1635 "cs.ATG" 
			fxStmt.PointerDeclarators.Add(new VariableDeclaration(identifier, expr)); 
			while (la.kind == 12) {
				lexer.NextToken();
				Expect(1);

#line  1637 "cs.ATG" 
				identifier = t.val; 
				Expect(3);
				Expr(
#line  1638 "cs.ATG" 
out expr);

#line  1638 "cs.ATG" 
				fxStmt.PointerDeclarators.Add(new VariableDeclaration(identifier, expr)); 
			}
			Expect(19);
			EmbeddedStatement(
#line  1640 "cs.ATG" 
out embeddedStatement);

#line  1640 "cs.ATG" 
			fxStmt.EmbeddedStatement = embeddedStatement; statement = fxStmt;
		} else SynErr(171);
	}
        public override object Visit(SwitchStatement switchStatement, object data)
        {
            outputFormatter.Indent();
            outputFormatter.PrintToken(Tokens.Switch);
            outputFormatter.Space();
            outputFormatter.PrintToken(Tokens.OpenParenthesis);
            switchStatement.SwitchExpression.AcceptVisitor(this, data);
            outputFormatter.PrintToken(Tokens.CloseParenthesis);
            outputFormatter.Space();
            outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
            outputFormatter.NewLine();
            ++outputFormatter.IndentationLevel;
            foreach (SwitchSection section in switchStatement.SwitchSections) {
                for (int i = 0; i < section.SwitchLabels.Count; ++i) {
                    Expression label = (Expression)section.SwitchLabels[i];
                    if (label == null) {
                        outputFormatter.Indent();
                        outputFormatter.PrintToken(Tokens.Default);
                        outputFormatter.PrintToken(Tokens.Colon);
                        outputFormatter.NewLine();
                        continue;
                    }

                    outputFormatter.Indent();
                    outputFormatter.PrintToken(Tokens.Case);
                    outputFormatter.Space();
                    label.AcceptVisitor(this, data);
                    outputFormatter.PrintToken(Tokens.Colon);
                    outputFormatter.NewLine();
                }

                ++outputFormatter.IndentationLevel;
                section.AcceptChildren(this, data);
                --outputFormatter.IndentationLevel;
            }
            --outputFormatter.IndentationLevel;
            outputFormatter.Indent();
            outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
            outputFormatter.NewLine();
            return null;
        }