The end position of given tree, if it is a block with
defined endpos.
13613
public static int endPos(JCTree tree) {
        if (tree.hasTag(BLOCK) && ((JCBlock) tree).endpos != Position.NOPOS)
            return ((JCBlock) tree).endpos;
        else if (tree.hasTag(SYNCHRONIZED))
            return endPos(((JCSynchronized) tree).body);
        else if (tree.hasTag(TRY)) {
            JCTry t = (JCTry) tree;
            return endPos((t.finalizer != null) ? t.finalizer
                          : (t.catchers.nonEmpty() ? t.catchers.last().body : t.body));
        } else
            return tree.pos;
    }
850632
function nodePosition(node) {
  let name = node.nodeName
  let position = 1
  while ((node = node.previousSibling)) {
    if (node.nodeName === name) position += 1
  }
  return position
}
325651
def _findExpressionEnd(self, block):
        
        while block.isValid():
            column = self._lastColumn(block)
            if column > 0:
                return block, column
            block = block.previous()
        raise UserWarning()
1072143
public static <T> T root(TreeDef.Parented<T> treeDef, T node) {
		T lastParent;
		T parent = node;
		do {
			lastParent = parent;
			parent = treeDef.parentOf(lastParent);
		} while (parent != null);
		return lastParent;
	}
101170
private PatriciaNode<V> findNearestNode(String key) {
        PatriciaNode<V> current = root.getLeft();
        PatriciaNode<V> parent = root;

        while (parent.getBit() < current.getBit()) {
            parent = current;
            if (!keyMapper.isSet(current.getBit(), key)) {
                current = current.getLeft();
            } else {
                current = current.getRight();
            }
        }
        return current;
    }
1049735
function isEndOfArrowBlock(lastToken) {
            if (!astUtils.isClosingBraceToken(lastToken)) {
                return false;
            }
            const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]);

            return (
                node.type === "BlockStatement" &&
                node.parent.type === "ArrowFunctionExpression"
            );
        }
1105380
def position_at_end(self, block):
        
        self._block = block
        self._anchor = len(block.instructions)
44496
def text_tree_prefix
      if (node = @parent)
        str = '+'
      else
        # Prefix start for root node line
        str = 'o'
      end

      while node
        last_child = false
        if node.parent
          if node.parent.smaller == node
            last_child = node.parent.equal.nil? && node.parent.larger.nil?
          elsif node.parent.equal == node
            last_child = node.parent.larger.nil?
          elsif node.parent.larger == node
            last_child = true
          end
        else
          # Padding for the root node
          str = '  ' + str
          break
        end

        str = (last_child ? '   ' : '|  ') + str
        node = node.parent
      end

      str
    end
627257
def positions(self, reverse=False):
        """"""
        def Posgen(reverse):
            if reverse:
                lastrootsib = self.last_sibling_position(self.root)
                current = self.last_decendant(lastrootsib)
                while current is not None:
                    yield current
                    current = self.prev_position(current)
            else:
                current = self.root
                while current is not None:
                    yield current
                    current = self.next_position(current)
        return Posgen(reverse)
308549
def getNodePosition(cls, start, height=None) -> int:
        
        pwr = highest_bit_set(start) - 1
        height = height or pwr
        if count_bits_set(start) == 1:
            adj = height - pwr
            return start - 1 + adj
        else:
            c = pow(2, pwr)
            return cls.getNodePosition(c, pwr) + \
                cls.getNodePosition(start - c, height)
534352
function getBlock() {
  const type = NodeType.BlockType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const end = tokens[pos].right;
  let content = [];

  // Skip `{`.
  pos++;

  while (pos < end) {
    if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());
    else throwError(pos);
  }

  const end_ = getLastPosition(content, line, column, 1);
  pos = end + 1;

  return newNode(type, content, line, column, end_);
}
795407
def _confirm_pos(self, pos):
        """"""
        candidate = None
        if self._get_node(self._treelist, pos) is not None:
            candidate = pos
        return candidate
360857
def xpointerNewRangeNodes(self, end):
        
        if end is None: end__o = None
        else: end__o = end._o
        ret = libxml2mod.xmlXPtrNewRangeNodes(self._o, end__o)
        if ret is None:raise treeError('xmlXPtrNewRangeNodes() failed')
        return xpathObjectRet(ret)
1044344
static boolean isTryFinallyNode(Node parent, Node child) {
    return parent.isTry() && parent.hasXChildren(3)
        && child == parent.getLastChild();
  }
1081922
boolean treeFinished(treeNode root){
		return (root.parent == null && root.lc == null && root.rc == null);
	}
848832
def get_children_treepos(self, treepos):
        """"""
        children_treepos = []
        for i, child in enumerate(self.dgtree[treepos]):
            if isinstance(child, nltk.Tree):
                children_treepos.append(child.treeposition())
            elif is_leaf(child):
                # we can't call .treeposition() on a leaf node
                treepos_list = list(treepos)
                treepos_list.append(i)
                leaf_treepos = tuple(treepos_list)
                children_treepos.append(leaf_treepos)
        return children_treepos
618294
private void findOptimalNodeOrder(final int block_size) {
		final Node<K, V> leaf = createLeafNode();
		final Node<K, V> internal = createInternalNode();
		// Get Maximal Size
		final int nodeSize = Math.max(leaf.getStructEstimateSize(MIN_B_ORDER),
				internal.getStructEstimateSize(MIN_B_ORDER));
		// Find minimal blockSize
		blockSize = ((nodeSize > block_size) ? roundBlockSize(nodeSize, block_size) : block_size);
		// Find b-order for Leaf Nodes
		b_order_leaf = findOptimalNodeOrder(leaf);
		// Find b-order for Internal Nodes
		b_order_internal = findOptimalNodeOrder(internal);
	}