def visitExp5(self, ctx: BKITParser.Exp5Context):
     if ctx.getChildCount() == 1:
         return self.visit(ctx.operand())
     else:
         op = ctx.getChild(0).getText()
         body = self.visit(ctx.exp5())
         return UnaryOp(op, body)
    def visitExp5(self, ctx: BKITParser.Exp5Context):
        if ctx.getChildCount() == 1:
            return ctx.exp6().accept(self)

        op = ctx.getChild(0).getText()
        body = ctx.exp5().accept(self)
        return UnaryOp(op, body)
예제 #3
0
 def visitExp5(self, ctx: BKITParser.Exp5Context):
     if ctx.getChildCount() > 1:
         body = self.visit(ctx.exp5())
         if ctx.NOT():
             op = str(ctx.NOT().getText())
         return UnaryOp(op, body)
     else:
         return self.visit(ctx.exp6())
예제 #4
0
 def visitExp5(self,ctx:BKITParser.Exp5Context):
     if ctx.SUB():
         return UnaryOp(
             ctx.SUB().getText(),
             self.visitExp5(ctx.exp5())
         )
     elif ctx.SUBDOT():
         return UnaryOp(
             ctx.SUBDOT().getText(),
             self.visitExp5(ctx.exp5())
         )
     else:
         temp = self.visitExp6(ctx.exp6())
         if isinstance(temp, list):
             return ArrayCell(temp[0], temp[1])
         else:
             return temp
예제 #5
0
 def visitExp5(self, ctx: BKITParser.Exp5Context):
     if ctx.getChildCount() == 1: return self.visit(ctx.exp6())
     elif ctx.SUB():
         return UnaryOp(ctx.SUB().getText(), self.visit(ctx.exp5()))
     else:
         return UnaryOp(ctx.SUBF().getText(), self.visit(ctx.exp5()))
예제 #6
0
 def visitExp5(self, ctx: BKITParser.Exp5Context):
     if ctx.getChildCount() == 2:
         return ArrayCell(self.visit(ctx.exp5()),
                          self.visit(ctx.dimensions()))
     else:
         return self.visit(ctx.exp6())
예제 #7
0
 def visitExp5(self, ctx: BKITParser.Exp5Context):
     if ctx.getChildCount() == 1:
         return self.visitChildren(ctx)
     return UnaryOp(ctx.getChild(0).getText(), self.visit(ctx.exp6()))
 def visitExp5(self, ctx: BKITParser.Exp5Context):
     return ctx.exp6().accept(
         self) if ctx.getChildCount() == 1 else UnaryOp(
             ctx.getChild(0).getText(),
             ctx.exp5().accept(self))
예제 #9
0
    def visitExp5(self, ctx: BKITParser.Exp5Context):

        return self.visit(ctx.exp6()) if ctx.getChildCount() == 1 else UnaryOp(
            ctx.Not().getText(), self.visit(ctx.exp5()))