ISelector GetPseudoFunction(CssFunctionToken arguments) { var creator = default(Func <CssSelectorConstructor, FunctionState>); if (pseudoClassFunctions.TryGetValue(arguments.Data, out creator)) { using (var function = creator(this)) { _ready = false; foreach (var token in arguments) { if (function.Finished(token)) { var sel = function.Produce(); if (_nested && function is NotFunctionState) { sel = null; } _ready = true; return(sel); } } } } return(null); }
/// <summary> /// Invoked once a colon with an identifier has been found in the token enumerator. /// </summary> /// <returns>The created function state.</returns> ISelector GetPseudoFunction(CssFunctionToken arguments) { Func <FunctionState> creator; if (pseudoClassFunctions.TryGetValue(arguments.Data, out creator)) { var function = creator(); 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); }
CssToken NewFunction(String value) { var function = new CssFunctionToken(value, _position); var token = Get(); while (token.Type != CssTokenType.EndOfFile) { function.AddArgumentToken(token); if (token.Type == CssTokenType.RoundBracketClose) { break; } token = Get(); } return(function); }
CssToken NewFunction(String value) { var function = new CssFunctionToken(value, _position); var token = Get(); while (token.Type != CssTokenType.Eof) { if (token.Type == CssTokenType.RoundBracketClose) { function.Close(token); break; } function.With(token); token = Get(); } return(function); }