def visitExp3(self, ctx: BKITParser.Exp3Context): if ctx.getChildCount() == 1: return self.visit(ctx.exp4()) else: left = self.visit(ctx.exp3()) right = self.visit(ctx.exp4()) return BinaryOp(ctx.getChild(1).getText(), left, right)
def visitExp3(self, ctx: BKITParser.Exp3Context): if ctx.getChildCount() == 1: return ctx.exp4().accept(self) left = ctx.exp3().accept(self) right = ctx.exp4().accept(self) op = ctx.getChild(1).getText() return BinaryOp(op, left, right)
def visitExp3(self, ctx: BKITParser.Exp3Context): if ctx.getChildCount() == 2: return UnaryOp( ctx.getChild(0).getText(), self.visit(ctx.getChild(1))) else: return self.visit(ctx.exp4())
def visitExp3(self, ctx: BKITParser.Exp3Context): if ctx.getChildCount() == 1: return self.visitChildren(ctx) return BinaryOp( ctx.getChild(1).getText(), self.visit(ctx.exp3()), self.visit(ctx.exp4()))
def visitExp3(self, ctx: BKITParser.Exp3Context): return ctx.exp4().accept( self) if ctx.getChildCount() == 1 else BinaryOp( ctx.getChild(1).getText(), ctx.exp3().accept(self), ctx.exp4().accept(self))