Exemple #1
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)
Exemple #2
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)
Exemple #3
0
    def visitAssign_stmt(self, ctx: BKITParser.Assign_stmtContext):
        param1 = None
        param2 = None
        if ctx.ID():
            param1 = Id(ctx.ID().getText())
        elif ctx.expr7():
            param1 = ArrayCell(ctx.expr7().accept(self), ctx.index_op().accept(self))


        param2 = ctx.expr().accept(self)

        return Assign(param1, param2)
Exemple #4
0
 def visitAssign_stmt(self, ctx:BKITParser.Assign_stmtContext):
     lhs = Id(ctx.ID().getText()) if ctx.ID() else self.visit( ctx.array_cell())
     rhs = self.visitExpr(ctx.expr())
     return Assign(lhs, rhs)
Exemple #5
0
 def visitAssign_stmt(self, ctx: BKITParser.Assign_stmtContext):
     if ctx.ID():
         return Assign(Id(ctx.ID().getText()), self.visit(ctx.getChild(2)))
     else:
         return Assign(self.visit(ctx.getChild(0)),
                       self.visit(ctx.getChild(2)))
Exemple #6
0
 def visitAssign_stmt(self, ctx: BKITParser.Assign_stmtContext):
     lhs = Id(ctx.ID().getText()) if ctx.ID() else self.visitComposite_var(
         ctx.composite_var())
     rhs = self.visitExpr(ctx.expr())
     return [AssignStmt(lhs, rhs)]
 def visitAssign_stmt(
         self,
         ctx: BKITParser.Assign_stmtContext):  # return Assign() object
     return Assign(ctx.lhs().accept(self), ctx.expression().accept(self))