예제 #1
0
 def visitExp4(self, ctx: MCParser.Exp4Context):
     if (ctx.getChildCount() == 1):
         return self.visit(ctx.getChild(0))
     else:
         return BinaryOp(
             ctx.getChild(1).getText(), self.visit(ctx.exp5(0)),
             self.visit(ctx.exp5(1)))
 def visitExp4(self, ctx:MCParser.Exp4Context):
     if ctx.getChildCount() == 1:
         return self.visit(ctx.exp5(0))
     else:
         op = ctx.getChild(1).getText()
         [left, right] = [self.visit(exp) for exp in ctx.exp5()]
         return BinaryOp(op, left, right)
예제 #3
0
 def visitExp4(self, ctx:MCParser.Exp4Context):
     if (ctx.getChildCount() == 1):
         return self.visit(ctx.exp5(0))
     left = self.visit(ctx.exp5(0))
     right = self.visit(ctx.exp5(1))
     op = ctx.getChild(1).getText()
     return BinaryOp(op,left,right)
예제 #4
0
 def visitExp4(self, ctx:MCParser.Exp4Context):
     if (ctx.getChildCount() == 1):
         return self.visit(ctx.exp5(0))
     else:
         op = ctx.getChild(1).getText()
         exp5 = self.visit(ctx.exp5(0))
         exp5_ = self.visit(ctx.exp5(1))  
         return BinaryOp(op,exp5,exp5_)
예제 #5
0
 def visitExp4(self, ctx: MCParser.Exp4Context):
     return BinaryOp(
         ctx.getChild(1).getText(), self.visit(ctx.exp5(0)),
         self.visit(ctx.exp5(1))) if ctx.exp5(1) else self.visit(
             ctx.exp5(0))
예제 #6
0
 def visitExp4(self, ctx: MCParser.Exp4Context):
     if ctx.getChildCount() == 1:
         return self.visit(ctx.exp5(0))
     op = ctx.getChild(1).getText()
     return BinaryOp(op, self.visit(ctx.exp5(0)), self.visit(ctx.exp5(1)))