private Selector ParseSelector()
        {
            List <SimpleSelectorSequence> simpleSelectorSequences = new List <SimpleSelectorSequence>();
            List <Combinator>             combinators             = new List <Combinator>();

            Combinator combinator = null;

            do
            {
                simpleSelectorSequences.Add(ParseSimpleSelectorSequence());

                combinator = ParseCombinator();
                if (combinator != null)
                {
                    combinators.Add(combinator);
                }
            }while (combinator != null);

            return(new Selector(simpleSelectorSequences, combinators));
        }
        private Combinator ParseCombinator()
        {
            Combinator combinator = null;

            if (!End)
            {
                Dictionary <SelectorTokenType, Combinator> lookup = new Dictionary <SelectorTokenType, Combinator>()
                {
                    { SelectorTokenType.Plus, new AdjacentSiblingCombinator() },
                    { SelectorTokenType.Greater, new ChildCombinator() },
                    { SelectorTokenType.Tilde, new GeneralSiblingCombinator() },
                    { SelectorTokenType.WhiteSpace, new DescendantCombinator() }
                };

                if (lookup.TryGetValue(CurrentToken.TokenType, out combinator))
                {
                    currentPosition++;
                    SkipWhiteSpace();
                }
            }
            return(combinator);
        }