Esempio n. 1
0
        private void InsertCommaDelimited()
        {
            if (_currentSelector == null)
            {
                return;
            }

            if (_aggregateSelectorList == null)
            {
                _aggregateSelectorList = new AggregateSelectorList(",");
            }

            if (_complexSelector != null)
            {
                _complexSelector.ConcludeSelector(_currentSelector);
                _aggregateSelectorList.AppendSelector(_complexSelector);
                _complexSelector = null;
            }
            else
            {
                _aggregateSelectorList.AppendSelector(_currentSelector);
            }

            _currentSelector = null;
        }
Esempio n. 2
0
        public ISelector GetResult()
        {
            if (!IsValid)
            {
                var selector = new UnknownSelector();
                return(selector);
            }

            if (_complex != null)
            {
                _complex.ConcludeSelector(_temp);
                _temp    = _complex;
                _complex = null;
            }

            if ((_group == null) || (_group.Length == 0))
            {
                return(_temp ?? SimpleSelector.All);
            }

            if ((_temp == null) && (_group.Length == 1))
            {
                return(_group[0]);
            }

            if (_temp != null)
            {
                _group.Add(_temp);
                _temp = null;
            }
            return(_group);
        }
Esempio n. 3
0
        private void Insert(ISelector selector)
        {
            if (_temp != null)
            {
                if (_combinators.Count == 0)
                {
                    var compound = _temp as CompoundSelector ?? new CompoundSelector {
                        _temp
                    };

                    compound.Add(selector);
                    _temp = compound;
                }
                else
                {
                    if (_complex == null)
                    {
                        _complex = new ComplexSelector();
                    }

                    var combinator = GetCombinator();
                    _complex.AppendSelector(_temp, combinator);
                    _temp = selector;
                }
            }
            else
            {
                _combinators.Clear();
                _temp = selector;
            }
        }
Esempio n. 4
0
        internal SelectorFactory ResetFactory()
        {
            _attributeName         = null;
            _attributeValue        = null;
            _attributeOperator     = string.Empty;
            _selectorOperation     = SelectorOperation.Data;
            _combinator            = Combinator.Descendent;
            _hasCombinator         = false;
            _currentSelector       = null;
            _aggregateSelectorList = null;
            _complexSelector       = null;

            return(this);
        }
Esempio n. 5
0
        private void Insert(BaseSelector selector)
        {
            if (_currentSelector != null)
            {
                if (!_hasCombinator)
                {
                    var compound = _currentSelector as AggregateSelectorList;

                    if (compound == null)
                    {
                        compound = new AggregateSelectorList("");
                        compound.AppendSelector(_currentSelector);
                    }

                    compound.AppendSelector(selector);
                    _currentSelector = compound;
                }
                else
                {
                    if (_complexSelector == null)
                    {
                        _complexSelector = new ComplexSelector();
                    }

                    _complexSelector.AppendSelector(_currentSelector, _combinator);
                    _combinator      = Combinator.Descendent;
                    _hasCombinator   = false;
                    _currentSelector = selector;
                }
            }
            else
            {
                if (_currentSelector == null && _complexSelector == null && _combinator == Combinator.Namespace)
                {
                    _complexSelector = new ComplexSelector();
                    _complexSelector.AppendSelector(SimpleSelector.Type(""), _combinator);
                    _currentSelector = selector;
                }
                else
                {
                    _combinator      = Combinator.Descendent;
                    _hasCombinator   = false;
                    _currentSelector = selector;
                }
            }
        }
Esempio n. 6
0
 public SelectorConstructor Reset(AttributeSelectorFactory attributeSelector,
                                  PseudoClassSelectorFactory pseudoClassSelector, PseudoElementSelectorFactory pseudoElementSelector)
 {
     _attrName  = null;
     _attrValue = null;
     _attrNs    = null;
     _attrOp    = string.Empty;
     _state     = State.Data;
     _combinators.Clear();
     _temp                  = null;
     _group                 = null;
     _complex               = null;
     _valid                 = true;
     IsNested               = false;
     _ready                 = true;
     _attributeSelector     = attributeSelector;
     _pseudoClassSelector   = pseudoClassSelector;
     _pseudoElementSelector = pseudoElementSelector;
     return(this);
 }
Esempio n. 7
0
        private void InsertOr()
        {
            if (_temp == null)
            {
                return;
            }

            if (_group == null)
            {
                _group = new ListSelector();
            }

            if (_complex != null)
            {
                _complex.ConcludeSelector(_temp);
                _group.Add(_complex);
                _complex = null;
            }
            else
            {
                _group.Add(_temp);
            }
            _temp = null;
        }