def count_parentheses(current_parentheses_count, token_text):
    """Count the number of parentheses."""
    current_parentheses_count = current_parentheses_count or 0
    if token_text in '([{':
        return current_parentheses_count + 1
    elif token_text in '}])':
        return current_parentheses_count - 1
    return current_parentheses_count
