public override void VisitAfter(BinaryOpExpr expr) { if (IsPlaceHolderExpr(expr.Left)) { expr.Left = PlaceInBinaryOp((PlaceHolderExpr)expr.Left); } if (IsPlaceHolderExpr(expr.Right)) { expr.Right = PlaceInBinaryOp((PlaceHolderExpr)expr.Right); } }
public override void VisitAfter(BinaryOpExpr expr) { var right = (Expr)_stack.Pop(); var left = (Expr)_stack.Pop(); if (object.ReferenceEquals(expr.Right, right) && object.ReferenceEquals(expr.Left, left)) { _stack.Push(expr); return; } var node = new BinaryOpExpr(left, expr.Operator, right, expr.Comments.Clone()); _stack.Push(node); }
virtual public void VisitOnOperator(BinaryOpExpr expr) { }
virtual public void VisitAfter(BinaryOpExpr expr) { }
virtual public void VisitBefore(BinaryOpExpr expr) { }
public void VisitOnOperator(BinaryOpExpr expr) { _visitor.VisitOnOperator(expr); }
public void VisitAfter(BinaryOpExpr expr) { _visitor.VisitAfter(expr); }
public void VisitBefore(BinaryOpExpr expr) { _visitor.VisitBefore(expr); }
public override void ExitBinaryOpExpr(MiniSqlParserParser.BinaryOpExprContext context) { var right = (Expr)_stack.Pop(); var comments = this.GetComments(context.op); var left = (Expr)_stack.Pop(); var opType = context.op.Type; ExpOperator op = ExpOperator.StringConcat; if (opType == MiniSqlParserLexer.PIPE2) { op = ExpOperator.StringConcat; } else if (opType == MiniSqlParserLexer.STAR) { op = ExpOperator.Mult; } else if (opType == MiniSqlParserLexer.DIV) { op = ExpOperator.Div; } else if (opType == MiniSqlParserLexer.MOD) { op = ExpOperator.Mod; } else if (opType == MiniSqlParserLexer.PLUS) { op = ExpOperator.Add; } else if (opType == MiniSqlParserLexer.MINUS) { op = ExpOperator.Sub; } else if (opType == MiniSqlParserLexer.LT2) { op = ExpOperator.LeftBitShift; } else if (opType == MiniSqlParserLexer.GT2) { op = ExpOperator.RightBitShift; } else if (opType == MiniSqlParserLexer.AMP) { op = ExpOperator.BitAnd; } else if (opType == MiniSqlParserLexer.PIPE) { op = ExpOperator.BitOr; } else if (opType == MiniSqlParserLexer.ARROW) { op = ExpOperator.GetJsonObj; } else if (opType == MiniSqlParserLexer.ARROW2) { op = ExpOperator.GetJsonObjAsText; } else if (opType == MiniSqlParserLexer.S_GT) { op = ExpOperator.GetJsonPath; } else if (opType == MiniSqlParserLexer.S_GT2) { op = ExpOperator.GetJsonPathAsText; } else if (opType == MiniSqlParserLexer.S_MINUS) { op = ExpOperator.DelJsonObj; } else { throw new InvalidEnumArgumentException("Undefined ExpOperator is used" , (int)opType , typeof(MiniSqlParserLexer)); } var node = new BinaryOpExpr(left, op, right, comments); _stack.Push(node); }