Ejemplo n.º 1
0
 def visitBlock_statement(self, ctx:MCParser.Block_statementContext):
     memberList = []
     for x in ctx.stmt_vardecl():
         member = self.visitStmt_vardecl(x)
         if isinstance(member, list): memberList.extend(member if member else [])
         else: memberList.append(member)
     return Block(memberList)
Ejemplo n.º 2
0
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     # block_statement: LP var_stm* RP;
     lstBlockMember = []
     lstVarStmt = ctx.var_stm()
     if (lstVarStmt != []):
         for item in lstVarStmt:
             temp = self.visit(item)
             if (isinstance(temp, list)):
                 lstBlockMember += temp
             else:
                 lstBlockMember += [temp]
     return Block(lstBlockMember)
 def visitBlock_statement(self,ctx:MCParser.Block_statementContext):
     return Block([item for item_block in ctx.list_in_block() for item in self.visit(item_block)]) if ctx.list_in_block() else Block([])
Ejemplo n.º 4
0
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     lst = [self.visit(x) for x in ctx.block_stmts()]
     stmt_list = functools.reduce(
         lambda x, y: x + y if isinstance(y, list) else x + [y], lst, [])
     return Block(stmt_list)
Ejemplo n.º 5
0
 def visitBlock_statement(self, ctx:MCParser.Block_statementContext):
     # block_statement : LB var_stmt_list RB ;
     return Block(self.visit(ctx.var_stmt_list()))
Ejemplo n.º 6
0
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     return Block([i for x in ctx.block() for i in self.visit(x)])
Ejemplo n.º 7
0
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     return Block(
         list(
             self.flatten(
                 self.visit(stm) for stm in list(ctx.getChildren())[1:-1])))
Ejemplo n.º 8
0
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     lst = []
     if (ctx.statements()):
         for x in ctx.statements():
             lst += self.visit(x)
     return Block(lst)
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     if ctx.statement():
         return Block(flatten(list(map(self.visit, ctx.statement()))))
     else:
         return Block([])
Ejemplo n.º 10
0
 def visitBlock_statement(self, ctx: MCParser.Block_statementContext):
     '''block_statement: LCB statement_list? RCB ;'''
     return Block(self.visit(
         ctx.statement_list())) if ctx.statement_list() else Block([])