Esempio n. 1
0
 def visitWith_stmt(self, ctx: MPParser.With_stmtContext):
     return [
         With([
             vardecl for varlist in ctx.variable()
             for vardecl in self.visit(varlist)
         ], self.visit(ctx.statement()))
     ]
Esempio n. 2
0
 def visitWith_stmt(self, ctx: MPParser.With_stmtContext):
     varDeclList = []
     for x in ctx.ids_list_with_type():
         varDeclList.extend(self.visitIds_list_with_type(x))
     stmt = self.visit(ctx.stmt())
     if not isinstance(stmt, list): stmt = [stmt]
     return With([VarDecl(id, dataType) for (id, dataType) in varDeclList],
                 stmt)
Esempio n. 3
0
 def visitWith_stmt(self, ctx: MPParser.With_stmtContext):
     return With(self.visit(ctx.var_dec_list()), self.visit(ctx.stmt()))
Esempio n. 4
0
 def visitWith_stmt(self, ctx: MPParser.With_stmtContext):
     if ctx.stmt().compound_stmt() is None:
         with_body = [self.visit(ctx.stmt())]
     else:
         with_body = self.visit(ctx.stmt())
     return With([self.visit(ctx.var_decl_list())], with_body)