private SimpleSelectorSequence ParseSimpleSelectorSequence() { ParseErrorIfEnd(); TypeSelector typeSelector = ParseTypeSelector() ?? ParseUniversalSelector(); List <IFilter> filters = new List <IFilter>(); while (true) { if (End) { break; } IFilter filterSelector = ParseIDFilter() ?? ParseClassFilter() ?? ParseAttributeFilter() ?? ParsePseudoFilter() ?? ParseNegationFilter(); if (filterSelector != null) { filters.Add(filterSelector); } else { break; } } if (typeSelector == null) { if (filters.Count == 0) { ParseError("Expected hash, class, attrib, pseudo, or negation"); } typeSelector = new UniversalSelector(); } return(new SimpleSelectorSequence(typeSelector, filters)); }
private TypeSelector ParseUniversalSelector() { TypeSelector selector = null; SelectorNamespacePrefix prefix = ParseNamespacePrefix(); if (CurrentToken != null && CurrentToken.Text == "*") { selector = new UniversalSelector(prefix); currentPosition++; } return(selector); }
private TypeSelector ParseUniversalSelector() { TypeSelector selector = null; SelectorNamespacePrefix prefix = ParseNamespacePrefix(); if (CurrentToken != null && CurrentToken.Text == "*") { selector = new UniversalSelector(prefix); currentPosition++; } return selector; }
private SimpleSelectorSequence ParseSimpleSelectorSequence() { ParseErrorIfEnd(); TypeSelector typeSelector = ParseTypeSelector() ?? ParseUniversalSelector(); List<IFilter> filters = new List<IFilter>(); while (true) { if (End) { break; } IFilter filterSelector = ParseIDFilter() ?? ParseClassFilter() ?? ParseAttributeFilter() ?? ParsePseudoFilter() ?? ParseNegationFilter(); if (filterSelector != null) { filters.Add(filterSelector); } else { break; } } if (typeSelector == null) { if (filters.Count == 0) { ParseError("Expected hash, class, attrib, pseudo, or negation"); } typeSelector = new UniversalSelector(); } return new SimpleSelectorSequence(typeSelector, filters); }