Adds comments.

This commit is contained in:
Henning Dieterichs
2021-08-26 16:09:09 +02:00
parent b61ed4aabd
commit f8e9f87b65
2 changed files with 3 additions and 0 deletions
@@ -8,6 +8,8 @@ import { AstNode, ListAstNode } from './ast';
/**
* Concatenates a list of (2,3) AstNode's into a single (2,3) AstNode.
* This mutates the items of the input array!
* If all items have the same height, this method has runtime O(items.length).
* Otherwise, it has runtime O(items.length * max(log(items.length), items.max(i => i.height))).
*/
export function concat23Trees(items: AstNode[]): AstNode | null {
if (items.length === 0) {
@@ -24,6 +24,7 @@ export class NodeReader {
/**
* Returns the longest node at `offset` that satisfies the predicate.
* Has runtime O(log n) where n is the number of nodes in the tree.
* @param offset must be greater than or equal to the last offset this method has been called with!
*/
readLongestNodeAt(offset: Length, predicate: (node: AstNode) => boolean): AstNode | undefined {