def METHOD_NAME(op, tokens):
    results = []
    stack = []
    paren_depth = 0
    brace_depth = 0
    for token in tokens:
        if token == ")":
            paren_depth -= 1
            stack.append(token)
        elif token == "(":
            paren_depth += 1
            stack.append(token)
        elif token == "}":
            brace_depth -= 1
            stack.append(token)
        elif token == "{":
            brace_depth += 1
            stack.append(token)
        elif paren_depth == 0 and brace_depth == 0 and token == op:
            results.append(stack)
            stack = []
        else:
            stack.append(token)
    if paren_depth < 0 or brace_depth < 0:
        raise SyntaxError(f"Unbalanced parenthesis or braces in path pattern {tokens}")
    results.append(stack)
    return results