Beispiel #1
0
        /// <summary>
        /// Takes a string and transforms it into a selector object.
        /// </summary>
        public ISelector ParseSelector(String selectorText)
        {
            var source      = new StringSource(selectorText);
            var tokenizer   = new CssTokenizer(source);
            var constructor = new CssSelectorConstructor(tokenizer, _attribute, _pseudoClass, _pseudoElement);

            return(constructor.Parse());
        }
 public ChildFunctionState(Func <Int32, Int32, ISelector, ISelector> creator, CssSelectorConstructor parent, Boolean withOptionalSelector = true)
 {
     _creator = creator;
     _parent  = parent;
     _allowOf = withOptionalSelector;
     _valid   = true;
     _sign    = 1;
     _state   = ParseState.Initial;
 }
            private Boolean OnBeforeOf(CssSelectorToken token)
            {
                if (token.Type == CssTokenType.Whitespace)
                {
                    return(false);
                }

                if (token.Data.Isi(Keywords.Of))
                {
                    _valid  = _allowOf;
                    _state  = ParseState.AfterOf;
                    _nested = _parent.CreateChild();
                    return(false);
                }
                else if (token.Type == CssTokenType.RoundBracketClose)
                {
                    return(true);
                }

                _valid = false;
                return(false);
            }
 public HostContextFunctionState(CssSelectorConstructor parent)
 {
     _selector = parent.CreateChild();
 }
 public MatchesFunctionState(CssSelectorConstructor parent)
 {
     _selector = parent.CreateChild();
 }
 public HasFunctionState(CssSelectorConstructor parent)
 {
     _nested = parent.CreateChild();
 }
 public NotFunctionState(CssSelectorConstructor parent)
 {
     _selector         = parent.CreateChild();
     _selector._nested = true;
 }