Exemplo n.º 1
0
        private ISelector GetPseudoFunction(FunctionToken arguments)
        {
            Func <SelectorConstructor, FunctionState> creator;

            if (!pseudoClassFunctions.TryGetValue(arguments.Data, out creator))
            {
                return(null);
            }

            using (var function = creator(this))
            {
                _ready = false;
                foreach (var token in arguments)
                {
                    if (function.Finished(token))
                    {
                        var sel = function.Produce();
                        if (IsNested && function is NotFunctionState)
                        {
                            sel = null;
                        }
                        _ready = true;
                        return(sel);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        private Token NewFunction(string value)
        {
            var function = new FunctionToken(value, _position);
            var token    = Get();

            while (token.Type != TokenType.EndOfFile)
            {
                function.AddArgumentToken(token);
                if (token.Type == TokenType.RoundBracketClose)
                {
                    break;
                }
                token = Get();
            }
            return(function);
        }
Exemplo n.º 3
0
 private bool Check(FunctionToken function)
 {
     return((function != null) && function.Data.Equals(_name, StringComparison.OrdinalIgnoreCase));
 }