Exemplo n.º 1
0
        private void ParsePseudoClass(Block token)
        {
            _selectorOperation = SelectorOperation.Data;

            switch (token.GrammarSegment)
            {
            case GrammarSegment.Colon:
                _selectorOperation = SelectorOperation.PseudoElement;
                break;

            case GrammarSegment.Function:
                _attributeName     = ((SymbolBlock)token).Value;
                _attributeValue    = string.Empty;
                _selectorOperation = SelectorOperation.PseudoClassFunction;

                _nestedSelectorFactory?.ResetFactory();

                break;

            case GrammarSegment.Ident:
                var pseudoSelector = GetPseudoSelector(token);

                if (pseudoSelector != null)
                {
                    Insert(pseudoSelector);
                }
                break;
            }
        }
Exemplo n.º 2
0
        private void SetParsingContext(ParsingContext newState)
        {
            switch (newState)
            {
            case ParsingContext.InSelector:
                _lexer.IgnoreComments   = true;
                _lexer.IgnoreWhitespace = false;
                _selectorFactory.ResetFactory();
                break;

            case ParsingContext.InHexValue:
            case ParsingContext.InUnknown:
            case ParsingContext.InCondition:
            case ParsingContext.InSingleValue:
            case ParsingContext.InMediaValue:
                _lexer.IgnoreComments   = true;
                _lexer.IgnoreWhitespace = false;
                break;

            default:
                _lexer.IgnoreComments   = true;
                _lexer.IgnoreWhitespace = true;
                break;
            }

            _parsingContext = newState;
        }