Пример #1
0
    def cond(self, ast):
        cmd1 = ast.c1
        cmd2 = ast.c2

        if not (isinstance(cmd1, pi.Cmd)):
            for i in range(1, len(ast.c1)):
                cmd1 = pi.CSeq(cmd1, ast.c1[i])

        if not (isinstance(cmd2, pi.Cmd)):
            for i in range(1, len(ast.c2)):
                cmd2 = pi.CSeq(cmd2, ast.c2[i])

        return pi.Cond(ast.e, cmd1, cmd2)
Пример #2
0
 def cond(self, ast):
     if ast.b2:
         return pi.Cond(ast.t, ast.b1, ast.b2)
     else:
         return pi.Cond(ast.t, ast.b1, pi.Nop())