def METHOD_NAME(s):
    tokens = []
    i = 0
    while i < len(s):
        m = SPACE_RE.match(s, i)
        i = m.end()
        if i >= len(s):
            break
        m = TOKEN_RE.match(s, i)
        if m is None or not m.group():
            raise ValueError('bad input at offset %d: %r' % (i, s[i:i + 10] + '...'))
        elif m.group('keyword'):
            tokens.append(Keyword(m.group('keyword')))
        elif m.group('symbol'):
            tokens.append(Symbol(m.group('symbol')))
        elif m.group('ident'):
            tokens.append(Ident(m.group('ident')))
        elif m.group('litstr'):
            tokens.append(LitStr(m.group('litstr').strip("'")))
        else:
            assert False
        i = m.end()
    return tokens