private IfStatement ParseIf() { IfStatement node = new IfStatement(curtok); Advance(); // advance over IF AssertAndAdvance(TokenID.LParen); node.Test = ParseExpression(); AssertAndAdvance(TokenID.RParen); ParseBlock(node.Statements); if (curtok.ID == TokenID.Else) { Advance(); // advance of else ParseBlock(node.ElseStatements); } if (curtok.ID == TokenID.Semi) Advance(); return node; }
public virtual object VisitIfStatement(IfStatement ifStatement, object data) { stackMap.Push(ifStatement); ifStatement.Test.AcceptVisitor( this, data ); ifStatement.ElseStatements.AcceptVisitor( this, data ); ifStatement.Statements.AcceptVisitor(this, data); stackMap.Pop(); return null; }