Exemplo n.º 1
0
        public void CreateBooleanAnd()
        {
            Expression expression = factory.CreateExpression(
                factory.CreateComparationEqual(factory.CreateFieldNode("FIELD"),
                                               factory.CreateValueNode("VALUE", ValueNodeType.Text)));


            BooleanAnd and = factory.CreateBooleanAnd(expression, expression);

            Assert.IsNotNull(and);
            Assert.IsInstanceOfType(typeof(BooleanAnd), and);
            Assert.IsInstanceOfType(typeof(Expression), and.LeftNode);
            Assert.IsInstanceOfType(typeof(Expression), and.RightNode);
        }
Exemplo n.º 2
0
        /// <summary>
        /// BOOLEAN Operation expression Rule
        ///  | BooleanRule
        ///  | BooleanRule AND BooleanOperatorRule
        ///  | BooleanRule OR BooleanOperatorRule
        /// <returns></returns>
        private Expression BooleanOperatorRule()
        {
            Expression booleanExp = BooleanRule();

            _token = _scanner.GetToken();

            switch (_token.Ttype)
            {
            case TokenType.AND:
                return(_astFactory.CreateBooleanAnd(booleanExp,
                                                    BooleanOperatorRule()));

            case TokenType.OR:
                return(_astFactory.CreateBooleanOr(booleanExp,
                                                   BooleanOperatorRule()));

            case TokenType.RIGHT_PARENTHESIS:
                _parenthesisDepth--;
                break;
            }

            return(booleanExp);
        }