def _parse_placeholder(token):
    """Infers paramstyle, name from sqlparse.tokens.Name.Placeholder."""
    import re
    import sqlparse
    if not isinstance(token, sqlparse.sql.Token
        ) or token.ttype != sqlparse.tokens.Name.Placeholder:
        raise TypeError()
    if token.value == '?':
        return 'qmark', None
    matches = re.search('^:([1-9]\\d*)$', token.value)
    if matches:
        return 'numeric', int(matches.group(1)) - 1
    matches = re.search('^:([a-zA-Z]\\w*)$', token.value)
    if matches:
        return 'named', matches.group(1)
    if token.value == '%s':
        return 'format', None
    matches = re.search('%\\((\\w+)\\)s$', token.value)
    if matches:
        return 'pyformat', matches.group(1)
    raise RuntimeError('{}: invalid placeholder'.format(token.value))
