def get_nodes_in_range()

in experimental/piranha_playground/rule_inference/utils/node_utils.py [0:0]


    def get_nodes_in_range(root: Node, start_byte, end_byte):
        nodes = []
        for child in root.children:
            if start_byte <= child.end_byte and end_byte >= child.start_byte:
                if start_byte <= child.start_byte and end_byte >= child.end_byte:
                    nodes.append(child)
                else:
                    nodes += NodeUtils.get_nodes_in_range(child, start_byte, end_byte)

        return NodeUtils.get_smallest_nonoverlapping_set(nodes)