Esempio n. 1
0
 def visitExp3(self, ctx: MPParser.Exp3Context):
     if ctx.getChildCount() == 1:
         return self.visit(ctx.getChild(0))
     else:
         return BinaryOp(
             ctx.getChild(1).getText(), self.visit(ctx.exp3()),
             self.visit(ctx.exp4()))
Esempio n. 2
0
 def visitExp3(self, ctx: MPParser.Exp3Context):
     if ctx.getChildCount() == 1:  # exp4
         return self.visit(ctx.exp4())
     left = self.visit(ctx.exp3())
     right = self.visit(ctx.exp4())
     op = ctx.getChild(1).getText()
     return BinaryOp(op, left, right)
Esempio n. 3
0
 def visitExp3(self, ctx: MPParser.Exp3Context):
     if ctx.getChildCount() == 1:
         return self.visit(ctx.exp4())
     op = ctx.getChild(1).getText()
     exp3 = self.visit(ctx.exp3())
     exp4 = self.visit(ctx.exp4())
     return BinaryOp(op, exp3, exp4)
 def visitExp3(self, ctx: MPParser.Exp3Context):
     '''dxp3: exp3 DIV_F exp4 | exp3 MUL exp4 | exp3 DIV exp4 | exp3 MOD exp4 | exp3 AND exp4 | exp4;'''
     return BinaryOp(
         ctx.getChild(1).getText(), self.visit(ctx.exp3()),
         self.visit(
             ctx.exp4())) if ctx.getChildCount() == 3 else self.visit(
                 ctx.exp4())
Esempio n. 5
0
 def visitExp3(self, ctx: MPParser.Exp3Context):
     log('visitExp3')
     if ctx.getChildCount() == 1:  # exp4
         return self.visit(ctx.exp4())
     left = self.visit(ctx.exp3())
     right = self.visit(ctx.exp4())
     op = ctx.getChild(1).getText()
     log1(left)
     log1(right)
     log1(op)
     return BinaryOp(op, left, right)
     return self.visitChildren(ctx)