public override object Visit(UsingStatement usingStatement, object data) { return null; }
public override object Visit(UsingStatement usingStatement, object data) { DebugOutput(usingStatement); // TODO : anything like this ? AppendIndentation();sourceText.Append("' Using ");AppendNewLine(); usingStatement.UsingStmnt.AcceptVisitor(this, data); AppendIndentation();sourceText.Append("' Inside ");AppendNewLine(); usingStatement.EmbeddedStatement.AcceptVisitor(this, data); AppendIndentation();sourceText.Append("' End Using");AppendNewLine(); return null; }
public override object Visit(UsingStatement usingStatement, object data) { Console.WriteLine(usingStatement.ToString()); return usingStatement.AcceptChildren(this, data); }
public virtual object Visit(UsingStatement usingStatement, object data) { object ret = data; if (usingStatement.UsingStmnt != null) { ret = usingStatement.UsingStmnt.AcceptVisitor(this, data); } if (usingStatement.EmbeddedStatement != null) { ret = usingStatement.EmbeddedStatement.AcceptVisitor(this, data); } return ret; }
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(UsingStatement usingStatement, object data) { outputFormatter.Indent(); outputFormatter.PrintToken(Tokens.Using); outputFormatter.Space(); outputFormatter.PrintToken(Tokens.OpenParenthesis); outputFormatter.DoIndent = false; outputFormatter.DoNewLine = false; outputFormatter.EmitSemicolon = false; usingStatement.UsingStmnt.AcceptVisitor(this,data); outputFormatter.DoIndent = true; outputFormatter.DoNewLine = true; outputFormatter.EmitSemicolon = true; outputFormatter.PrintToken(Tokens.CloseParenthesis); usingStatement.EmbeddedStatement.AcceptVisitor(this,data); outputFormatter.NewLine(); return null; }