Exemplo n.º 1
0
 public object Visit(IfActionNode n, object o)
 {
     Append($"{AddIndent()}if (");
     n.Expression.Accept(this, null);
     AppendLine(")");
     AppendLine($"{AddIndent()}{{");
     IncreaseIndent();
     n.Actions.Accept(this, null);
     DecreaseIndent();
     AppendLine($"{AddIndent()}}}");
     n.ElseIfs.Accept(this, null);
     n.Else.Accept(this, null);
     return(null);
 }
Exemplo n.º 2
0
        private ActionNode SelectionStatement()
        {
            ActionNode         itsAST;
            SourceCodePosition itsPos = _currentToken.SourcePosition;

            Accept(Token.TokenType.If);
            Accept(Token.TokenType.LeftParen);
            ExpressionNode itsExpr = Expression();

            Accept(Token.TokenType.RightParen);
            Accept(Token.TokenType.LeftBrace);
            ActionSequenceNode itsActions = ActionStatements();

            Accept(Token.TokenType.RightBrace);
            ActionSequenceNode itsElseifs = ElseIfStatements();
            ActionNode         itsElse    = ElseStatement();

            itsAST = new IfActionNode(itsExpr, itsActions, itsElseifs, itsElse, itsPos);
            return(itsAST);
        }
Exemplo n.º 3
0
 public object Visit(IfActionNode n, object o)
 {
     return(null);
 }