private void PrasePseudoClassFunctionEnd(Block token)
        {
            _selectorOperation = SelectorOperation.Data;

            if (token.GrammarSegment != GrammarSegment.ParenClose)
            {
                return;
            }

            switch (_attributeName)
            {
            case PseudoSelectorPrefix.PseudoFunctionNthchild:
                Insert(GetChildSelector <NthFirstChildSelector>());
                break;

            case PseudoSelectorPrefix.PseudoFunctionNthlastchild:
                Insert(GetChildSelector <NthLastChildSelector>());
                break;

            case PseudoSelectorPrefix.PseudoFunctionNthOfType:
                Insert(GetChildSelector <NthOfTypeSelector>());
                break;

            case PseudoSelectorPrefix.PseudoFunctionNthLastOfType:
                Insert(GetChildSelector <NthLastOfTypeSelector>());
                break;

            case PseudoSelectorPrefix.PseudoFunctionNot:
            {
                var selector = _nestedSelectorFactory.GetSelector();
                var code     = string.Format("{0}({1})", PseudoSelectorPrefix.PseudoFunctionNot, selector);
                Insert(SimpleSelector.PseudoClass(code));
                break;
            }

            case PseudoSelectorPrefix.PseudoFunctionDir:
            {
                var code = string.Format("{0}({1})", PseudoSelectorPrefix.PseudoFunctionDir, _attributeValue);
                Insert(SimpleSelector.PseudoClass(code));
                break;
            }

            case PseudoSelectorPrefix.PseudoFunctionLang:
            {
                var code = string.Format("{0}({1})", PseudoSelectorPrefix.PseudoFunctionLang, _attributeValue);
                Insert(SimpleSelector.PseudoClass(code));
                break;
            }

            case PseudoSelectorPrefix.PseudoFunctionContains:
            {
                var code = string.Format("{0}({1})", PseudoSelectorPrefix.PseudoFunctionContains, _attributeValue);
                Insert(SimpleSelector.PseudoClass(code));
                break;
            }
            }
        }
        private static BaseSelector GetPseudoSelector(Block token)
        {
            switch (((SymbolBlock)token).Value)
            {
            case PseudoSelectorPrefix.PseudoRoot:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoRoot));

            case PseudoSelectorPrefix.PseudoFirstOfType:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoFirstOfType));

            case PseudoSelectorPrefix.PseudoLastoftype:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoLastoftype));

            case PseudoSelectorPrefix.PseudoOnlychild:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoOnlychild));

            case PseudoSelectorPrefix.PseudoOnlyOfType:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoOnlyOfType));

            case PseudoSelectorPrefix.PseudoFirstchild:
                return(FirstChildSelector.Instance);

            case PseudoSelectorPrefix.PseudoLastchild:
                return(LastChildSelector.Instance);

            case PseudoSelectorPrefix.PseudoEmpty:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoEmpty));

            case PseudoSelectorPrefix.PseudoLink:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoLink));

            case PseudoSelectorPrefix.PseudoVisited:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoVisited));

            case PseudoSelectorPrefix.PseudoActive:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoActive));

            case PseudoSelectorPrefix.PseudoHover:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoHover));

            case PseudoSelectorPrefix.PseudoFocus:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoFocus));

            case PseudoSelectorPrefix.PseudoTarget:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoTarget));

            case PseudoSelectorPrefix.PseudoEnabled:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoEnabled));

            case PseudoSelectorPrefix.PseudoDisabled:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoDisabled));

            case PseudoSelectorPrefix.PseudoDefault:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoDefault));

            case PseudoSelectorPrefix.PseudoChecked:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoChecked));

            case PseudoSelectorPrefix.PseudoIndeterminate:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoIndeterminate));

            case PseudoSelectorPrefix.PseudoUnchecked:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoUnchecked));

            case PseudoSelectorPrefix.PseudoValid:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoValid));

            case PseudoSelectorPrefix.PseudoInvalid:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoInvalid));

            case PseudoSelectorPrefix.PseudoRequired:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoRequired));

            case PseudoSelectorPrefix.PseudoReadonly:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoReadonly));

            case PseudoSelectorPrefix.PseudoReadwrite:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoReadwrite));

            case PseudoSelectorPrefix.PseudoInrange:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoInrange));

            case PseudoSelectorPrefix.PseudoOutofrange:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoOutofrange));

            case PseudoSelectorPrefix.PseudoOptional:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoOptional));

            case PseudoSelectorPrefix.PseudoElementBefore:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoElementBefore));

            case PseudoSelectorPrefix.PseudoElementAfter:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoElementAfter));

            case PseudoSelectorPrefix.PseudoElementFirstline:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoElementFirstline));

            case PseudoSelectorPrefix.PseudoElementFirstletter:
                return(SimpleSelector.PseudoClass(PseudoSelectorPrefix.PseudoElementFirstletter));

            default:
                return(SimpleSelector.PseudoClass(token.ToString()));
            }
        }