Example #1
0
IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(IDBKeyPathElement& element)
{
    while (m_ptr < m_end && isASCIISpace(*m_ptr))
        ++m_ptr;

    if (m_ptr >= m_end)
        return TokenEnd;

    ASSERT(m_ptr < m_end);
    switch (*m_ptr) {
    case '[':
        ++m_ptr;
        return TokenLeftBracket;
    case ']':
        ++m_ptr;
        return TokenRightBracket;
    case '.':
        ++m_ptr;
        return TokenDot;
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
        return lexNumber(element);
    default:
        return lexIdentifier(element);
    }
    return TokenError;
}
IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(String& element)
{
    if (m_index >= m_length)
        return TokenEnd;
    ASSERT(m_index < m_length);

    if (m_string[m_index] == '.') {
        ++m_index;
        return TokenDot;
    }
    return lexIdentifier(element);
}
Example #3
0
IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(String& element)
{
    if (m_ptr >= m_end)
        return TokenEnd;
    ASSERT_WITH_SECURITY_IMPLICATION(m_ptr < m_end);

    if (*m_ptr == '.') {
        ++m_ptr;
        return TokenDot;
    }
    return lexIdentifier(element);
}
Example #4
0
IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(String& element)
{
    if (m_remainingText.isEmpty())
        return TokenEnd;

    if (m_remainingText[0] == '.') {
        m_remainingText = m_remainingText.substring(1);
        return TokenDot;
    }

    return lexIdentifier(element);
}