public static Selector Parse(string str) { Selector result = new Selector(); SelectorReader reader = new SelectorReader(str); SelectorCombinator combinator = null; SimpleSelectorChain simpleSelectors = new SimpleSelectorChain(); while (!reader.EndOfStream) { switch (reader.Status) { case SelectorReader.ReadStatus.Combinator: result.Add(combinator, simpleSelectors); combinator = reader.ReadCombinator(); simpleSelectors = new SimpleSelectorChain(); break; case SelectorReader.ReadStatus.SimpleSelector: SimpleSelector simpleSelector = reader.ReadSimpleSelector(); if (simpleSelector.Type == SelectorType.PseudoElement) { result.PseudoElementSelector = simpleSelector; } simpleSelectors.Add(simpleSelector); break; } } result.Add(combinator, simpleSelectors); return result; }
public static Selector Parse(string str) { Selector result = new Selector(); SelectorReader reader = new SelectorReader(str); SelectorCombinator combinator = null; SimpleSelectorChain simpleSelectors = new SimpleSelectorChain(); while (!reader.EndOfStream) { switch (reader.Status) { case SelectorReader.ReadStatus.Combinator: result.Add(combinator, simpleSelectors); combinator = reader.ReadCombinator(); simpleSelectors = new SimpleSelectorChain(); break; case SelectorReader.ReadStatus.SimpleSelector: SimpleSelector simpleSelector = reader.ReadSimpleSelector(); if (simpleSelector.Type == SelectorType.PseudoElement) { result.PseudoElementSelector = simpleSelector; } simpleSelectors.Add(simpleSelector); break; } } result.Add(combinator, simpleSelectors); return(result); }