示例#1
0
 def visitExp7(self, ctx:MCParser.Exp7Context):
     if ctx.SUB():
         return UnaryOp(ctx.SUB().getText(), self.visitExp7(ctx.exp7()))
     elif ctx.NOT():
         return UnaryOp(ctx.NOT().getText(), self.visitExp7(ctx.exp7()))
     else:
         return self.visitExp8(ctx.exp8())
示例#2
0
 def visitExp7(self, ctx: MCParser.Exp7Context):
     # exp7: (SUB|NOT) exp7 | exp8;
     if (ctx.SUB()):
         return UnaryOp(ctx.SUB().getText(), self.visit(ctx.exp7()))
     elif (ctx.NOT()):
         return UnaryOp(ctx.NOT().getText(), self.visit(ctx.exp7()))
     else:
         return self.visit(ctx.exp8())
示例#3
0
 def visitExp7(self, ctx: MCParser.Exp7Context):
     if ctx.SUB():
         return UnaryOp("-", self.visit(ctx.exp7()))
     elif ctx.NOT():
         return UnaryOp("!", self.visit(ctx.exp7()))
     else:
         return self.visit(ctx.exp8())