예제 #1
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)
예제 #2
0
 def visitExp3(self, ctx: MPParser.Exp3Context):
     if ctx.getChildCount() == 1:
         return self.visit(ctx.exp4())
     else:
         return BinaryOp(
             ctx.getChild(1).getText(), self.visit(ctx.exp3()),
             self.visit(ctx.exp4()))
예제 #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())
예제 #5
0
 def visitExp3(self, ctx:MPParser.Exp3Context):
     if ctx.getChildCount() == 3:
         exp0 = self.visit(ctx.exp3())
         exp1 = self.visit(ctx.exp4())
         op = self.visit(ctx.multiplicativeOperator())
         return BinaryOp(op,exp0,exp1)
     else:
         return self.visit(ctx.exp4())
예제 #6
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)