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); }
/// <summary> /// BOOLEAN expression Rule /// | '(' BooleanRule ')' /// | OperationRule /// <returns></returns> private Expression BooleanRule() { _token = _scanner.GetToken(); switch (_token.Ttype) { case TokenType.LEFT_PARENTHESIS: _parenthesisDepth++; return(BooleanOperatorRule()); case TokenType.FIELD: FieldNode fieldNode = _astFactory.CreateFieldNode(_token.Value); return(_astFactory.CreateExpression(ComparationRule(fieldNode))); default: throw new ParserException("Field expected."); } }