def _stack_removal(self, start_index): all_nodes = [node for stack_node in self.stack[start_index:] for node in stack_node.nodes] if all_nodes: self.stack[start_index - 1].nodes.append(tree.PythonErrorNode(all_nodes)) self.stack[start_index:] = [] return bool(all_nodes)
def _stack_removal(self, start_index): all_nodes = [node for stack_node in self.stack[start_index:] for node in stack_node.nodes] if all_nodes: node = tree.PythonErrorNode(all_nodes) for n in all_nodes: n.parent = node self.stack[start_index - 1].nodes.append(node) self.stack[start_index:] = [] return bool(all_nodes)
def _stack_removal(self, pgen_grammar, stack, arcs, start_index, value, start_pos): failed_stack = False found = False all_nodes = [] for dfa, state, (type_, nodes) in stack[start_index:]: if nodes: found = True if found: failed_stack = True all_nodes += nodes if failed_stack: stack[start_index - 1][2][1].append(tree.PythonErrorNode(all_nodes)) stack[start_index:] = [] return failed_stack