def visitExp2(self, ctx: MCParser.Exp2Context):
     #exp2: exp2 AND exp3 | exp3;
     if ctx.getChildCount() == 3:
         return BinaryOp(ctx.AND().getText(), self.visit(ctx.exp2()),
                         self.visit(ctx.exp3()))
     else:
         return self.visit(ctx.exp3())
示例#2
0
 def visitExp2(self, ctx:MCParser.Exp2Context):
     if (ctx.getChildCount() == 1):
         return self.visit(ctx.exp3())
     left = self.visit(ctx.exp2())
     right = self.visit(ctx.exp3())
     op = ctx.AND().getText()
     return BinaryOp(op,left,right)
示例#3
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     if (ctx.getChildCount() == 1):
         return self.visit(ctx.getChild(0))
     else:
         return BinaryOp(
             ctx.getChild(1).getText(), self.visit(ctx.exp2()),
             self.visit(ctx.exp3()))
 def visitExp2(self, ctx:MCParser.Exp2Context):
     if ctx.AND_OP():
         op = ctx.AND_OP().getText()
         left = self.visit(ctx.exp2())
         right = self.visit(ctx.exp3())
         return BinaryOp(op, left, right)
     else:
         return self.visit(ctx.exp3())
示例#5
0
 def visitExp2(self, ctx:MCParser.Exp2Context):
     if (ctx.getChildCount() == 1):
         return self.visit(ctx.exp3())
     else:
         and_ = ctx.getChild(1).getText()
         exp2 = self.visit(ctx.exp2())
         exp3 = self.visit(ctx.exp3())
         return BinaryOp(and_,exp2,exp3)
示例#6
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     '''exp2: exp3 ( EQ | NEQ ) exp3 | exp3 ;'''
     if ctx.getChildCount() == 1:
         return self.visit(ctx.exp3(0))
     else:
         left = self.visit(ctx.exp3(0))
         right = self.visit(ctx.exp3(1))
         op = ctx.EQ().getText() if ctx.EQ() else ctx.NEQ().getText()
         return BinaryOp(op, left, right)
示例#7
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     if ctx.AND():
         return BinaryOp(ctx.AND().getText(), self.visit(ctx.exp2()),
                         self.visit(ctx.exp3()))
     return self.visit(ctx.exp3())
示例#8
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     if ctx.getChildCount() == 3:
         return BinaryOp(ctx.LOGICALAND().getText(), self.visit(ctx.exp2()),
                         self.visit(ctx.exp3()))
     else:
         return self.visit(ctx.exp3())
示例#9
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     return BinaryOp(ctx.ANDOP().getText(), self.visit(ctx.exp2()),self.visit(ctx.exp3())) if ctx.getChildCount() == 3 \
         else self.visit(ctx.exp3())
示例#10
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     # exp2: exp2 AND exp3 | exp3;
     return BinaryOp(ctx.AND().getText(), self.visit(ctx.exp2()),
                     self.visit(ctx.exp3())) if ctx.AND() else self.visit(
                         ctx.exp3())
示例#11
0
 def visitExp2(self, ctx: MCParser.Exp2Context):
     if ctx.AND():
         return BinaryOp("&&", self.visit(ctx.exp2()),
                         self.visit(ctx.exp3()))
     else:
         return self.visit(ctx.exp3())