void IVisitor.VisitBefore(SubQueryPredicate predicate)
 {
     this.ParentExists(predicate);
 }
 void IVisitor.Visit(SubQueryPredicate predicate, int offset)
 {
     this.ParentExists(predicate);
 }
 void IVisitor.VisitAfter(SubQueryPredicate predicate)
 {
     this.ParentExists(predicate);
 }
        public override void ExitSubQueryPredicate(MiniSqlParserParser.SubQueryPredicateContext context)
        {
            var comments = this.GetComments(context);

            var query = (IQuery)_stack.Pop();

            var             opType2    = context.op2.Type;
            QueryQuantifier quantifier = QueryQuantifier.Any;

            if (opType2 == MiniSqlParserLexer.K_ANY)
            {
                quantifier = QueryQuantifier.Any;
            }
            else if (opType2 == MiniSqlParserLexer.K_SOME)
            {
                quantifier = QueryQuantifier.Some;
            }
            else if (opType2 == MiniSqlParserLexer.K_ALL)
            {
                quantifier = QueryQuantifier.All;
            }
            else
            {
                throw new CannotBuildASTException("Undifined QueryQuantifier is used");
            }

            var opType1 = context.op1.Type;
            PredicateOperator operater = PredicateOperator.Equal;

            if (opType1 == MiniSqlParserLexer.ASSIGN)
            {
                operater = PredicateOperator.Equal;
            }
            else if (opType1 == MiniSqlParserLexer.NOT_EQ2)
            {
                operater = PredicateOperator.NotEqual;
            }
            else if (opType1 == MiniSqlParserLexer.LT)
            {
                operater = PredicateOperator.Less;
            }
            else if (opType1 == MiniSqlParserLexer.LT_EQ)
            {
                operater = PredicateOperator.LessOrEqual;
            }
            else if (opType1 == MiniSqlParserLexer.GT)
            {
                operater = PredicateOperator.Greater;
            }
            else if (opType1 == MiniSqlParserLexer.GT_EQ)
            {
                operater = PredicateOperator.GreaterOrEqual;
            }
            else if (opType1 == MiniSqlParserLexer.EQ)
            {
                operater = PredicateOperator.Equal2;
            }
            else if (opType1 == MiniSqlParserLexer.NOT_EQ1)
            {
                operater = PredicateOperator.NotEqual2;
            }
            else
            {
                throw new CannotBuildASTException("Undifined PredicateOperator is used");
            }

            var operand = (Expr)_stack.Pop();

            var node = new SubQueryPredicate(operand, operater, quantifier, query, comments);

            _stack.Push(node);
        }