Ejemplo n.º 1
0
        public void Visit(ElifStatementNode node)
        {
            currentElseCount++;

            builder.AppendLine($"\tIf_{currentIfId}_{currentElseCount}_condition:");
            Visit((dynamic)node[0]);
            builder.AppendLine($"\t\tbrzero If_{currentIfId}_{currentElseCount + 1}_condition");
            builder.AppendLine();

            builder.AppendLine($"\tIf_{currentIfId}_{currentElseCount}_body:");
            VisitChildren(node, 1);
            builder.AppendLine($"\t\tbr If_{currentIfId}_End");
            builder.AppendLine();
        }
Ejemplo n.º 2
0
        public Node ElifStatement()
        {
            var elif_node = new ElifStatementNode()
            {
                AnchorToken = Expect(TokenCategory.ELSEIF)
            };

            elif_node.Add(Expression());
            Expect(TokenCategory.THEN);
            if (Has(firstOfStatement))
            {
                elif_node.Add(new StatementListNode()
                {
                    ZeroOrMore(firstOfStatement, Statement)
                });
            }
            return(elif_node);
        }
Ejemplo n.º 3
0
 public Type Visit(ElifStatementNode node)
 {
     VerifyCondition(node);
     Visit((dynamic)node[1]);
     return(Type.VOID);
 }