Examples of SelectorNode


Examples of com.bazaarvoice.jless.ast.node.SelectorNode

            // Visit the parent selector group and clone its selector nodes
            _parentSelectorGroup.traverse(new InclusiveNodeVisitor() {
                @Override
                public boolean exit(SelectorNode parentSelector) {
                    SelectorNode parentSelectorClone = parentSelector.clone();

                    // Add the current selector from the nested rule set to the cloned selector node from the parent.
                    // SelectorNode listens for additions of other SelectorNodes, and will absorb its children properly.
                    parentSelectorClone.addChild(selector.clone());

                    // Add the new selector to the selector group
                    selectorGroupIterator.add(parentSelectorClone);
                    return true;
                }
View Full Code Here

Examples of com.bazaarvoice.jless.ast.node.SelectorNode

     * Special case rule that builds a selector for only a single class
     */
    Rule ClassSelectorGroup() {
        return Sequence(
                Class(),
                push(new SelectorGroupNode(new SelectorNode(new SelectorSegmentNode("", match()))))
        );
    }
View Full Code Here

Examples of com.bazaarvoice.jless.ast.node.SelectorNode

     * SimpleSelector (Combinator SimpleSelector)*
     */
    Rule Selector() {
        Var<SelectorSegmentNode> selectorSegmentNode = new Var<SelectorSegmentNode>();
        return Sequence(
                push(new SelectorNode()),
                // First selector segment may have a combinator (with nested rule sets)
                Optional(SymbolCombinator()),
                selectorSegmentNode.set(new SelectorSegmentNode(match())),
                SimpleSelector(selectorSegmentNode),
                selectorSegmentNode.get().setSimpleSelector(match()),
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

        for (int n = 0 ; n < INVALID_SELECTORS.length; n++)
        {
            System.out.print("TESTING invalid ["+INVALID_SELECTORS[n]+"] ");
            try
            {
              SelectorNode node = new MessageSelectorParser(INVALID_SELECTORS[n]).parse();
              System.out.println(node);
              fail("Should have failed : "+INVALID_SELECTORS[n]);
            }
            catch (InvalidSelectorException e)
            {
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

     */
    public SelectorNode parse() throws InvalidSelectorException
    {
        if (isEndOfExpression())
            return null;
        SelectorNode expr = parseExpression();
        if (!isEndOfExpression())
            throw new InvalidSelectorException("Unexpected token : "+currentToken);
        if (!(expr instanceof ConditionalExpression))   
            throw new InvalidSelectorException("Selector expression is not a boolean expression");
       
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

        return parseOrExpression();
    }
   
    private SelectorNode parseSpecialConstructs() throws InvalidSelectorException
    {
        SelectorNode lNode = parseComparison();
       
        if (isSpecialOperator(currentToken))
        {
          if (currentToken.equalsIgnoreCase("is null"))
            {
                readNextToken(); // skip operator
                return new IsNullOperator(lNode);
            }
            if (currentToken.equalsIgnoreCase("is not null"))
            {
                readNextToken(); // skip operator
                return new IsNotNullOperator(lNode);
            }
            if (currentToken.equalsIgnoreCase("is true"))
            {
                readNextToken(); // skip operator
                return new EqualsOperator(lNode,new BooleanLiteral(Boolean.TRUE));
            }
            if (currentToken.equalsIgnoreCase("is false"))
            {
                readNextToken(); // skip operator
                return new EqualsOperator(lNode,new BooleanLiteral(Boolean.FALSE));
            }
            if (currentToken.equalsIgnoreCase("is not true"))
            {
                readNextToken(); // skip operator
                return new EqualsOperator(lNode,new BooleanLiteral(Boolean.FALSE));
            }
            if (currentToken.equalsIgnoreCase("is not false"))
            {
                readNextToken(); // skip operator
                return new EqualsOperator(lNode,new BooleanLiteral(Boolean.TRUE));
            }
            if (currentToken.equalsIgnoreCase("in"))
            {
                readNextToken(); // skip operator
                return new InOperator(lNode, parseListConstruct());
            }
            if (currentToken.equalsIgnoreCase("not in"))
            {
                readNextToken(); // skip operator
                return new NotInOperator(lNode, parseListConstruct());
            }
            if (currentToken.equalsIgnoreCase("like"))
            {
              readNextToken(); // skip operator             
                return new LikeOperator(lNode, parsePatternExpression(), parseEscapeExpression());
            }
            if (currentToken.equalsIgnoreCase("not like"))
            {
                readNextToken(); // skip operator
                return new NotLikeOperator(lNode, parsePatternExpression(), parseEscapeExpression());
            }
            if (currentToken.equalsIgnoreCase("between"))
            {
                readNextToken(); // skip 'between'
                SelectorNode lowerBound = parseAdditiveExpression();
                if (isEndOfExpression())
                    throw new InvalidSelectorException("Unexpected end of expression");
                if (!currentToken.equalsIgnoreCase("and"))
                    throw new InvalidSelectorException("Expected an AND operator after lower bound in BETWEEN construct");
                readNextToken(); // Skip 'and'
                SelectorNode upperBound = parseAdditiveExpression();
               
                return new BetweenOperator(lNode, lowerBound, upperBound);
            }
            if (currentToken.equalsIgnoreCase("not between"))
            {
                readNextToken(); // skip 'between'
                SelectorNode lowerBound = parseAdditiveExpression();
                if (isEndOfExpression())
                    throw new InvalidSelectorException("Unexpected end of expression");
                if (!currentToken.equalsIgnoreCase("and"))
                    throw new InvalidSelectorException("Expected an AND operator after lower bound in BETWEEN construct");
                readNextToken(); // Skip 'and'
                SelectorNode upperBound = parseAdditiveExpression();
               
                return new NotBetweenOperator(lNode, lowerBound, upperBound);
            }
        }
       
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

        readNextToken(); // Skip (
       
        List items = new ArrayList();
        while (!isEndOfExpression() && !currentToken.equals(")"))
        {
            SelectorNode item = parseBaseExpression();
            items.add(item);
           
            if (isEndOfExpression())
                throw new InvalidSelectorException("Unexpected end of expression");
            if (currentToken.equals(","))
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

    private SelectorNode parsePatternExpression() throws InvalidSelectorException
    {
        if (isEndOfExpression())
          throw new InvalidSelectorException("Expected pattern operand after LIKE operator");

        SelectorNode patternNode = parseBaseExpression();
        if (!(patternNode instanceof StringLiteral))
          throw new InvalidSelectorException("pattern operand of LIKE operator should be a string literal");

        return patternNode;
    }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

    private SelectorNode parseEscapeExpression() throws InvalidSelectorException
    {
        if (!isEndOfExpression() && currentToken.equalsIgnoreCase("escape"))
        {
            readNextToken(); // skip escape
            SelectorNode escapeNode = parseBaseExpression();
            if (!(escapeNode instanceof StringLiteral))
              throw new InvalidSelectorException("escape operand of LIKE operator should be a string literal");
            String value = (String)((StringLiteral)escapeNode).getValue();
            if (value.length() != 1)
              throw new InvalidSelectorException("escape operand of LIKE operator must contain one and only one character");
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.selector.expression.SelectorNode

        return null;
    }
   
    private SelectorNode parseAndExpression() throws InvalidSelectorException
  {
      SelectorNode lNode = parseSpecialConstructs();

    while (!isEndOfExpression() && currentToken.equalsIgnoreCase("and"))
    {
      readNextToken(); // skip 'and'
      lNode = new AndOperator(lNode, parseSpecialConstructs());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.