Package com.bazaarvoice.jless.ast.node

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


@Test
public class NodeTest {

    public void testChildIterators() {
        InternalNode p = new PlaceholderNode();
        p.addChild(new SimpleNode("c1"));
        p.addChild(new SimpleNode("c2"));
        p.addChild(new SimpleNode("c3"));
        p.addChild(new SimpleNode("c4"));

        RandomAccessListIterator i1 = p.pushChildIterator();
        i1.next();
        RandomAccessListIterator i2 = p.pushChildIterator();
        i2.next();
        i2.next();
        RandomAccessListIterator i3 = p.pushChildIterator();
        i3.next();
        i3.next();
        i3.next();

        Assert.assertEquals(i1.nextIndex(), 1);
        Assert.assertEquals(i2.nextIndex(), 2);
        Assert.assertEquals(i3.nextIndex(), 3);
       
        p.addChild(2, new SimpleNode("c2a"));

        Assert.assertEquals(i1.nextIndex(), 1);
        Assert.assertEquals(i2.nextIndex(), 3);
        Assert.assertEquals(i3.nextIndex(), 4);
    }
View Full Code Here


     * "@media" Ws0 "only "? MediaType
     */
    Rule MediaQuery() {
        return Sequence(
            push(new MediaQueryNode()),
            MediaQueryDefinition(), peek(1).addChild(pop()), peek().addChild(new SimpleNode(" ")),
            Ws0(),
            Optional(OnlyIndicator()),
            OneOrMore(MediaType()), Ws0(),
            '{', Scope(), '}',
            peek(1).addChild(pop()),
View Full Code Here

    * simple media type name
    */
    Rule MediaTypeName() {
        return Sequence(
              OneOrMore(NameCharacter()),
              push(new SimpleNode(match()))
        );
    }
View Full Code Here

    Rule MediaTypeRestriction() {
        return Sequence(
            push(new MediaTypeRestriction()),
            Ws0(), "and", Ws0(), '(',
            Sequence(
                    Ident(), peek().addChild(new SimpleNode(match())),
                    ':', peek().addChild(new SimpleNode(":")),
                    Optional(Ws0()),
                    peek().addChild(new SpacingNode(" ")),
                    ExpressionPhrase()
            ),
            ')',
View Full Code Here

     * "only" Whitespace
     */
    Rule OnlyIndicator() {
        return Sequence(
                "only",
                peek().addChild(new SimpleNode(match())), peek().addChild(new SimpleNode(" ")),
                Ws0()
        );
    }
View Full Code Here

    /**
     * '!' Ws0 'important'
     */
    Rule Important() {
        return Sequence('!', Ws0(), "important", push(new SimpleNode("!important")));
    }
View Full Code Here

    }

    Rule MediaQueryDefinition() {
        return Sequence(
                "@media",
                push(new SimpleNode(match()))
        );
    }
View Full Code Here

                                String(),
                                OneOrMore(FirstOf(AnyOf("-_%$/.&=:;#+?"), Alphanumeric()))
                        ), Ws0(),
                        ')'
                ),
                push(new SimpleNode(match()))
        );
    }
View Full Code Here

                        "opacity", Ws0(),
                        '=', Ws0(),
                        Digit1(), Ws0(),
                        ')'
                ),
                push(new SimpleNode(match()))
        );
    }
View Full Code Here

                                ),
                                ANY
                        ),
                        ')'
                ),
                push(new SimpleNode(match()))
        );
    }
View Full Code Here

TOP

Related Classes of com.bazaarvoice.jless.ast.node.SimpleNode

Copyright © 2018 www.massapicom. 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.