Beispiel #1
0
        /// <summary>
        /// 4.4.10. Ident-rest state
        /// </summary>
        CssToken IdentRest(Char current)
        {
            while (true)
            {
                if (current.IsName())
                {
                    stringBuffer.Append(current);
                }
                else if (IsValidEscape(current))
                {
                    current = src.Next;
                    stringBuffer.Append(ConsumeEscape(current));
                }
                else if (current == '(')
                {
                    if (stringBuffer.ToString().Equals("url", StringComparison.OrdinalIgnoreCase))
                    {
                        stringBuffer.Clear();
                        return(UrlStart(src.Next));
                    }

                    return(CssKeywordToken.Function(FlushBuffer()));
                }
                //false could be replaced with a transform whitespace flag, which is set to true if in SVG transform mode.
                //else if (false && Specification.IsSpaceCharacter(current))
                //    InstantSwitch(TransformFunctionWhitespace);
                else
                {
                    src.Back();
                    return(CssKeywordToken.Ident(FlushBuffer()));
                }

                current = src.Next;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 4.4.5. Hash-rest state
        /// </summary>
        CssToken HashRest(Char current)
        {
            while (true)
            {
                if (current.IsName())
                {
                    stringBuffer.Append(current);
                }
                else if (IsValidEscape(current))
                {
                    current = src.Next;
                    stringBuffer.Append(ConsumeEscape(current));
                }
                else if (current == Specification.RSOLIDUS)
                {
                    RaiseErrorOccurred(ErrorCode.InvalidCharacter);
                    src.Back();
                    return(CssKeywordToken.Hash(FlushBuffer()));
                }
                else
                {
                    src.Back();
                    return(CssKeywordToken.Hash(FlushBuffer()));
                }

                current = src.Next;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 4.4.11. Transform-function-whitespace state
        /// </summary>
        CssToken TransformFunctionWhitespace(Char current)
        {
            while (true)
            {
                current = src.Next;

                if (current == '(')
                {
                    src.Back();
                    return(CssKeywordToken.Function(FlushBuffer()));
                }
                else if (!current.IsSpaceCharacter())
                {
                    src.Back(2);
                    return(CssKeywordToken.Ident(FlushBuffer()));
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 4.4.8. At-keyword-rest state
        /// </summary>
        CssToken AtKeywordRest(Char current)
        {
            while (true)
            {
                if (current.IsName())
                {
                    stringBuffer.Append(current);
                }
                else if (IsValidEscape(current))
                {
                    current = src.Next;
                    stringBuffer.Append(ConsumeEscape(current));
                }
                else
                {
                    src.Back();
                    return(CssKeywordToken.At(FlushBuffer()));
                }

                current = src.Next;
            }
        }