Beispiel #1
0
 def visitExpression(self, ctx: MPParser.ExpressionContext):
     if (ctx.indexexpre()):
         return self.visit(ctx.indexexpre())
     elif (ctx.invoexpre()):
         return self.visit(ctx.invoexpre())
     else:
         return self.visit(ctx.exp1())
Beispiel #2
0
 def visitExpression(self, ctx: MPParser.ExpressionContext):
     op = ""
     if ctx.AND() and ctx.THEN():
         op = "andthen"
         left = self.visit(ctx.expression())
         right = self.visit(ctx.expression1())
         return BinaryOp(op, left, right)
     elif ctx.OR() and ctx.ELSE():
         op = "orelse"
         left = self.visit(ctx.expression())
         right = self.visit(ctx.expression1())
         return BinaryOp(op, left, right)
     else:
         return self.visit(ctx.expression1())
Beispiel #3
0
    def visitExpression(self, ctx: MPParser.ExpressionContext):
        #expression: expression AND THEN expression1| expression OR ELSE expression1| expression1

        if ctx.getChildCount() == 1:
            return self.visit(ctx.expression1())
        elif ctx.AND():
            return BinaryOp("andthen", self.visit(ctx.expression()),
                            self.visit(ctx.expression1()))
        elif ctx.OR():
            return BinaryOp("orelse", self.visit(ctx.expression()),
                            self.visit(ctx.expression1()))
Beispiel #4
0
	def visitExpression(self, ctx:MPParser.ExpressionContext):
		if(ctx.getChildCount() == 3):
			if ctx.andthen():
				return BinaryOp("andthen",self.visit(ctx.expression()),self.visit(ctx.expression1()))
			else:
				return BinaryOp("orelse",self.visit(ctx.expression()),self.visit(ctx.expression1()))
		else:
			return self.visit(ctx.expression1())
Beispiel #5
0
 def visitExpression(self, ctx: MPParser.ExpressionContext):
     if (ctx.THEN()):
         return BinaryOp('andthen', self.visit(ctx.expression()),
                         self.visit(ctx.exp1()))
     elif (ctx.ELSE()):
         return BinaryOp('orelse', self.visit(ctx.expression()),
                         self.visit(ctx.exp1()))
     else:
         return self.visit(ctx.exp1())
Beispiel #6
0
 def visitExpression(self, ctx:MPParser.ExpressionContext):
     #print("expr")
     if ctx.getChildCount() == 1:
         return self.visitChildren(ctx)
     elif ctx.getChild(1) == ctx.ANDTHEN():
         andthen = "andthen"
         return BinaryOp(andthen,self.visit(ctx.expression()),self.visit(ctx.expression1()))
     else: 
         orelse = "orelse" 
         return BinaryOp(orelse,self.visit(ctx.expression()),self.visit(ctx.expression1()))
Beispiel #7
0
 def visitExpression(self, ctx: MPParser.ExpressionContext):
     return self.visit(ctx.exp1())
Beispiel #8
0
 def visitExpression(self, ctx:MPParser.ExpressionContext):
     return self.visit(ctx.getChild(0))