Exemplo n.º 1
0
    def visitAssign_stmt(self, ctx: BKITParser.Assign_stmtContext):
        lhs = None
        rhs = self.visit(ctx.exp()) if ctx.exp() else None
        if ctx.element_expression():
            lhs = self.visit(ctx.element_expression())

        if ctx.ID():
            lhs = Id(ctx.ID().getText())

        return Assign(lhs, rhs)
Exemplo n.º 2
0
 def visitAssign_stmt(self, ctx:BKITParser.Assign_stmtContext):
     temp_lhs = None
     getID = Id(ctx.ID().getText())
     if ctx.op_index():
         lstOpIdx = []
         for x in ctx.op_index():
             getOpIdx = self.visitOp_index(x)
             if isinstance(getOpIdx, list):
                 lstOpIdx.extend(getOpIdx if getOpIdx else [])
             else:
                 lstOpIdx.append(getOpIdx)
         temp_lhs = ArrayCell(getID, lstOpIdx)
     else:
         temp_lhs = getID
     temp_rhs = self.visitExp(ctx.exp())
     return Assign(temp_lhs, temp_rhs)