/// <summary>Gets the next valid token.</summary> /// <returns>the next valid token</returns> public virtual CssDeclarationValueTokenizer.Token GetNextValidToken() { CssDeclarationValueTokenizer.Token token = GetNextToken(); while (token != null && !token.IsString() && String.IsNullOrEmpty(token.GetValue().Trim())) { token = GetNextToken(); } if (token != null && functionDepth > 0) { StringBuilder functionBuffer = new StringBuilder(); while (token != null && functionDepth > 0) { ProcessFunctionToken(token, functionBuffer); token = GetNextToken(); } functionDepth = 0; if (functionBuffer.Length != 0) { if (token != null) { ProcessFunctionToken(token, functionBuffer); } return(new CssDeclarationValueTokenizer.Token(functionBuffer.ToString(), CssDeclarationValueTokenizer.TokenType .FUNCTION)); } } return(token); }
/// <summary>Processes a function token.</summary> /// <param name="token">the token</param> /// <param name="functionBuffer">the function buffer</param> private void ProcessFunctionToken(CssDeclarationValueTokenizer.Token token, StringBuilder functionBuffer) { if (token.IsString()) { functionBuffer.Append(stringQuote); functionBuffer.Append(token.GetValue()); functionBuffer.Append(stringQuote); } else { functionBuffer.Append(token.GetValue()); } }