in AjaxMinDll/Css/CssScanner.cs [88:235]
public CssToken NextToken()
{
GotEndOfLine = false;
// advance the context
m_context.Advance();
m_rawNumber = null;
CssToken token = null;
bool tryAgain;
do
{
tryAgain = false;
switch (m_currentChar)
{
case '\0':
// end of file
m_isAtEOF = true;
break;
case '\r':
case '\n':
case '\f':
// we hit an end-of-line character, but treat it like any other whitespace
GotEndOfLine = true;
goto case ' ';
case ' ':
case '\t':
token = ScanWhiteSpace();
break;
case '/':
token = ScanComment();
if (token == null)
{
// this could happen if we processed an ajaxmin directive.
// go around again and try for the next token
tryAgain = true;
}
break;
case '<':
if (AllowEmbeddedAspNetBlocks && PeekChar() == '%')
{
token = ScanAspNetBlock();
}
else
{
token = ScanCDO();
}
break;
case '-':
token = ScanCDC();
if (token == null)
{
// identifier in CSS2.1 and CSS3 can start with a hyphen
// to indicate vendor-specific identifiers.
string ident = GetIdent();
if (ident != null)
{
// vendor-specific identifier
// but first see if it's a vendor-specific function!
if (m_currentChar == '(')
{
// it is -- consume the parenthesis; it's part of the token
NextChar();
token = new CssToken(GetVendorSpecificFunctionType(ident), "-" + ident + '(', m_context);
}
else
{
// nope -- just a regular identifier
token = new CssToken(TokenType.Identifier, "-" + ident, m_context);
}
}
else
{
// just a hyphen character
token = new CssToken(TokenType.Character, '-', m_context);
}
}
break;
case '~':
token = ScanIncludes();
break;
case '|':
token = ScanDashMatch();
break;
case '^':
token = ScanPrefixMatch();
break;
case '$':
token = ScanSuffixMatch();
break;
case '*':
token = ScanSubstringMatch();
break;
case '\'':
case '"':
token = ScanString();
break;
case '#':
token = ScanHash();
break;
case '@':
token = ScanAtKeyword();
break;
case '!':
token = ScanImportant();
break;
case 'U':
case 'u':
token = ScanUrl();
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '.':
token = ScanNum();
break;
default:
token = ScanIdent();
break;
}
} while (tryAgain);
return token;
}