def parse_int(token):
    """Convert a token of a integer literal to its integer value.

    >>> parse_int("100")
    100
    >>> parse_int("0xA")
    10

    """
    if token.startswith("0x"):
        return int(token, base=16)
    elif token.startswith("0o"):
        return int(token, base=8)
    else:
        return int(token)