@lezer/common 0.15.6 → 0.15.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +89 -35
- package/dist/index.js +89 -35
- package/dist/tree.cjs +484 -347
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.d.ts +77 -0
- package/dist/tree.es.js +482 -346
- package/dist/tree.es.js.map +1 -1
- package/package.json +1 -1
package/dist/tree.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.es.js","sources":["../src/tree.ts"],"sourcesContent":["/// The default maximum length of a `TreeBuffer` node.\nexport const DefaultBufferLength = 1024\n\nlet nextPropID = 0\n\nconst CachedNode = new WeakMap<Tree, TreeNode>()\n\n/// Each [node type](#tree.NodeType) can have metadata associated with\n/// it in props. Instances of this class represent prop names.\nexport class NodeProp<T> {\n /// @internal\n id: number\n\n /// A method that deserializes a value of this prop from a string.\n /// Can be used to allow a prop to be directly written in a grammar\n /// file. Defaults to raising an error.\n deserialize: (str: string) => T\n\n /// Create a new node prop type. You can optionally pass a\n /// `deserialize` function.\n constructor({deserialize}: {deserialize?: (str: string) => T} = {}) {\n this.id = nextPropID++\n this.deserialize = deserialize || (() => {\n throw new Error(\"This node type doesn't define a deserialize function\")\n })\n }\n\n /// Create a string-valued node prop whose deserialize function is\n /// the identity function.\n static string() { return new NodeProp<string>({deserialize: str => str}) }\n\n /// Create a number-valued node prop whose deserialize function is\n /// just `Number`.\n static number() { return new NodeProp<number>({deserialize: Number}) }\n\n /// Creates a boolean-valued node prop whose deserialize function\n /// returns true for any input.\n static flag() { return new NodeProp<boolean>({deserialize: () => true}) }\n\n /// Store a value for this prop in the given object. This can be\n /// useful when building up a prop object to pass to the\n /// [`NodeType`](#tree.NodeType) constructor. Returns its first\n /// argument.\n set(propObj: {[prop: number]: any}, value: T) {\n propObj[this.id] = value\n return propObj\n }\n\n /// This is meant to be used with\n /// [`NodeSet.extend`](#tree.NodeSet.extend) or\n /// [`Parser.withProps`](#lezer.Parser.withProps) to compute prop\n /// values for each node type in the set. Takes a [match\n /// object](#tree.NodeType^match) or function that returns undefined\n /// if the node type doesn't get this prop, and the prop's value if\n /// it does.\n add(match: {[selector: string]: T} | ((type: NodeType) => T | undefined)): NodePropSource {\n if (typeof match != \"function\") match = NodeType.match(match)\n return (type) => {\n let result = (match as (type: NodeType) => T | undefined)(type)\n return result === undefined ? null : [this, result]\n }\n }\n\n /// Prop that is used to describe matching delimiters. For opening\n /// delimiters, this holds an array of node names (written as a\n /// space-separated string when declaring this prop in a grammar)\n /// for the node types of closing delimiters that match it.\n static closedBy = new NodeProp<readonly string[]>({deserialize: str => str.split(\" \")})\n\n /// The inverse of [`closedBy`](#tree.NodeProp^closedBy). This is\n /// attached to closing delimiters, holding an array of node names\n /// of types of matching opening delimiters.\n static openedBy = new NodeProp<readonly string[]>({deserialize: str => str.split(\" \")})\n\n /// Used to assign node types to groups (for example, all node\n /// types that represent an expression could be tagged with an\n /// `\"Expression\"` group).\n static group = new NodeProp<readonly string[]>({deserialize: str => str.split(\" \")})\n}\n\n/// Type returned by [`NodeProp.add`](#tree.NodeProp.add). Describes\n/// the way a prop should be added to each node type in a node set.\nexport type NodePropSource = (type: NodeType) => null | [NodeProp<any>, any]\n\n// Note: this is duplicated in lezer/src/constants.ts\nconst enum NodeFlag {\n Top = 1,\n Skipped = 2,\n Error = 4,\n Anonymous = 8\n}\n\nconst noProps: {[propID: number]: any} = Object.create(null)\n\n/// Each node in a syntax tree has a node type associated with it.\nexport class NodeType {\n /// @internal\n constructor(\n /// The name of the node type. Not necessarily unique, but if the\n /// grammar was written properly, different node types with the\n /// same name within a node set should play the same semantic\n /// role.\n readonly name: string,\n /// @internal\n readonly props: {readonly [prop: number]: any},\n /// The id of this node in its set. Corresponds to the term ids\n /// used in the parser.\n readonly id: number,\n /// @internal\n readonly flags: number = 0) {}\n\n static define(spec: {\n /// The ID of the node type. When this type is used in a\n /// [set](#tree.NodeSet), the ID must correspond to its index in\n /// the type array.\n id: number, \n /// The name of the node type. Leave empty to define an anonymous\n /// node.\n name?: string,\n /// [Node props](#tree.NodeProp) to assign to the type. The value\n /// given for any given prop should correspond to the prop's type.\n props?: readonly ([NodeProp<any>, any] | NodePropSource)[],\n /// Whether is is a [top node](#tree.NodeType.isTop).\n top?: boolean,\n /// Whether this node counts as an [error\n /// node](#tree.NodeType.isError).\n error?: boolean,\n /// Whether this node is a [skipped](#tree.NodeType.isSkipped)\n /// node.\n skipped?: boolean\n }) {\n let props = spec.props && spec.props.length ? Object.create(null) : noProps\n let flags = (spec.top ? NodeFlag.Top : 0) | (spec.skipped ? NodeFlag.Skipped : 0) |\n (spec.error ? NodeFlag.Error : 0) | (spec.name == null ? NodeFlag.Anonymous : 0)\n let type = new NodeType(spec.name || \"\", props, spec.id, flags)\n if (spec.props) for (let src of spec.props) {\n if (!Array.isArray(src)) src = src(type)!\n if (src) src[0].set(props, src[1])\n }\n return type\n }\n\n /// Retrieves a node prop for this type. Will return `undefined` if\n /// the prop isn't present on this node.\n prop<T>(prop: NodeProp<T>): T | undefined { return this.props[prop.id] }\n\n /// True when this is the top node of a grammar.\n get isTop() { return (this.flags & NodeFlag.Top) > 0 }\n\n /// True when this node is produced by a skip rule.\n get isSkipped() { return (this.flags & NodeFlag.Skipped) > 0 }\n\n /// Indicates whether this is an error node.\n get isError() { return (this.flags & NodeFlag.Error) > 0 }\n\n /// When true, this node type doesn't correspond to a user-declared\n /// named node, for example because it is used to cache repetition.\n get isAnonymous() { return (this.flags & NodeFlag.Anonymous) > 0 }\n\n /// Returns true when this node's name or one of its\n /// [groups](#tree.NodeProp^group) matches the given string.\n is(name: string | number) {\n if (typeof name == 'string') {\n if (this.name == name) return true\n let group = this.prop(NodeProp.group)\n return group ? group.indexOf(name) > -1 : false\n }\n return this.id == name\n }\n\n /// An empty dummy node type to use when no actual type is available.\n static none: NodeType = new NodeType(\"\", Object.create(null), 0, NodeFlag.Anonymous)\n\n /// Create a function from node types to arbitrary values by\n /// specifying an object whose property names are node or\n /// [group](#tree.NodeProp^group) names. Often useful with\n /// [`NodeProp.add`](#tree.NodeProp.add). You can put multiple\n /// names, separated by spaces, in a single property name to map\n /// multiple node names to a single value.\n static match<T>(map: {[selector: string]: T}): (node: NodeType) => T | undefined {\n let direct = Object.create(null)\n for (let prop in map)\n for (let name of prop.split(\" \")) direct[name] = map[prop]\n return (node: NodeType) => {\n for (let groups = node.prop(NodeProp.group), i = -1; i < (groups ? groups.length : 0); i++) {\n let found = direct[i < 0 ? node.name : groups![i]]\n if (found) return found\n }\n }\n }\n}\n\n/// A node set holds a collection of node types. It is used to\n/// compactly represent trees by storing their type ids, rather than a\n/// full pointer to the type object, in a number array. Each parser\n/// [has](#lezer.Parser.nodeSet) a node set, and [tree\n/// buffers](#tree.TreeBuffer) can only store collections of nodes\n/// from the same set. A set can have a maximum of 2**16 (65536)\n/// node types in it, so that the ids fit into 16-bit typed array\n/// slots.\nexport class NodeSet {\n /// Create a set with the given types. The `id` property of each\n /// type should correspond to its position within the array.\n constructor(\n /// The node types in this set, by id.\n readonly types: readonly NodeType[]\n ) {\n for (let i = 0; i < types.length; i++) if (types[i].id != i)\n throw new RangeError(\"Node type ids should correspond to array positions when creating a node set\")\n }\n\n /// Create a copy of this set with some node properties added. The\n /// arguments to this method should be created with\n /// [`NodeProp.add`](#tree.NodeProp.add).\n extend(...props: NodePropSource[]): NodeSet {\n let newTypes: NodeType[] = []\n for (let type of this.types) {\n let newProps = null\n for (let source of props) {\n let add = source(type)\n if (add) {\n if (!newProps) newProps = Object.assign({}, type.props)\n add[0].set(newProps, add[1])\n }\n }\n newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type)\n }\n return new NodeSet(newTypes)\n }\n}\n\n/// A piece of syntax tree. There are two ways to approach these\n/// trees: the way they are actually stored in memory, and the\n/// convenient way.\n///\n/// Syntax trees are stored as a tree of `Tree` and `TreeBuffer`\n/// objects. By packing detail information into `TreeBuffer` leaf\n/// nodes, the representation is made a lot more memory-efficient.\n///\n/// However, when you want to actually work with tree nodes, this\n/// representation is very awkward, so most client code will want to\n/// use the `TreeCursor` interface instead, which provides a view on\n/// some part of this data structure, and can be used to move around\n/// to adjacent nodes.\nexport class Tree {\n /// Construct a new tree. You usually want to go through\n /// [`Tree.build`](#tree.Tree^build) instead.\n constructor(\n readonly type: NodeType,\n /// The tree's child nodes. Children small enough to fit in a\n /// `TreeBuffer will be represented as such, other children can be\n /// further `Tree` instances with their own internal structure.\n readonly children: readonly (Tree | TreeBuffer)[],\n /// The positions (offsets relative to the start of this tree) of\n /// the children.\n readonly positions: readonly number[],\n /// The total length of this tree\n readonly length: number\n ) {}\n\n /// @internal\n toString(): string {\n let children = this.children.map(c => c.toString()).join()\n return !this.type.name ? children :\n (/\\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) +\n (children.length ? \"(\" + children + \")\" : \"\")\n }\n\n /// The empty tree\n static empty = new Tree(NodeType.none, [], [], 0)\n\n /// Get a [tree cursor](#tree.TreeCursor) rooted at this tree. When\n /// `pos` is given, the cursor is [moved](#tree.TreeCursor.moveTo)\n /// to the given position and side.\n cursor(pos?: number, side: -1 | 0 | 1 = 0): TreeCursor {\n let scope = (pos != null && CachedNode.get(this)) || (this.topNode as TreeNode)\n let cursor = new TreeCursor(scope)\n if (pos != null) {\n cursor.moveTo(pos, side)\n CachedNode.set(this, cursor._tree)\n }\n return cursor\n }\n\n /// Get a [tree cursor](#tree.TreeCursor) that, unlike regular\n /// cursors, doesn't skip [anonymous](#tree.NodeType.isAnonymous)\n /// nodes.\n fullCursor(): TreeCursor {\n return new TreeCursor(this.topNode as TreeNode, true)\n }\n\n /// Get a [syntax node](#tree.SyntaxNode) object for the top of the\n /// tree.\n get topNode(): SyntaxNode {\n return new TreeNode(this, 0, 0, null)\n }\n\n /// Get the [syntax node](#tree.SyntaxNode) at the given position.\n /// If `side` is -1, this will move into nodes that end at the\n /// position. If 1, it'll move into nodes that start at the\n /// position. With 0, it'll only enter nodes that cover the position\n /// from both sides.\n resolve(pos: number, side: -1 | 0 | 1 = 0) {\n return this.cursor(pos, side).node\n }\n\n /// Iterate over the tree and its children, calling `enter` for any\n /// node that touches the `from`/`to` region (if given) before\n /// running over such a node's children, and `leave` (if given) when\n /// leaving the node. When `enter` returns `false`, the given node\n /// will not have its children iterated over (or `leave` called).\n iterate(spec: {\n enter(type: NodeType, from: number, to: number): false | void,\n leave?(type: NodeType, from: number, to: number): void,\n from?: number,\n to?: number\n }) {\n let {enter, leave, from = 0, to = this.length} = spec\n for (let c = this.cursor();;) {\n let mustLeave = false\n if (c.from <= to && c.to >= from && (c.type.isAnonymous || enter(c.type, c.from, c.to) !== false)) {\n if (c.firstChild()) continue\n if (!c.type.isAnonymous) mustLeave = true\n }\n for (;;) {\n if (mustLeave && leave) leave(c.type, c.from, c.to)\n mustLeave = c.type.isAnonymous\n if (c.nextSibling()) break\n if (!c.parent()) return\n mustLeave = true\n }\n }\n }\n\n /// Balance the direct children of this tree.\n balance(maxBufferLength = DefaultBufferLength) {\n return this.children.length <= BalanceBranchFactor ? this\n : balanceRange(this.type, NodeType.none, this.children, this.positions, 0, this.children.length, 0,\n maxBufferLength, this.length, 0)\n }\n\n /// Build a tree from a postfix-ordered buffer of node information,\n /// or a cursor over such a buffer.\n static build(data: BuildData) { return buildTree(data) }\n}\n\n// For trees that need a context hash attached, we're using this\n// kludge which assigns an extra property directly after\n// initialization (creating a single new object shape).\nfunction withHash(tree: Tree, hash: number) {\n if (hash) (tree as any).contextHash = hash\n return tree\n}\n\ntype BuildData = {\n /// The buffer or buffer cursor to read the node data from.\n ///\n /// When this is an array, it should contain four values for every\n /// node in the tree.\n ///\n /// - The first holds the node's type, as a node ID pointing into\n /// the given `NodeSet`.\n /// - The second holds the node's start offset.\n /// - The third the end offset.\n /// - The fourth the amount of space taken up in the array by this\n /// node and its children. Since there's four values per node,\n /// this is the total number of nodes inside this node (children\n /// and transitive children) plus one for the node itself, times\n /// four.\n ///\n /// Parent nodes should appear _after_ child nodes in the array. As\n /// an example, a node of type 10 spanning positions 0 to 4, with\n /// two children, of type 11 and 12, might look like this:\n ///\n /// [11, 0, 1, 4, 12, 2, 4, 4, 10, 0, 4, 12]\n buffer: BufferCursor | readonly number[],\n /// The node types to use.\n nodeSet: NodeSet,\n /// The id of the top node type, if any.\n topID?: number,\n /// The position the tree should start at. Defaults to 0.\n start?: number,\n /// The length of the wrapping node. The end offset of the last\n /// child is used when not provided.\n length?: number,\n /// The maximum buffer length to use. Defaults to\n /// [`DefaultBufferLength`](#tree.DefaultBufferLength).\n maxBufferLength?: number,\n /// An optional set of reused nodes that the buffer can refer to.\n reused?: (Tree | TreeBuffer)[],\n /// The first node type that indicates repeat constructs in this\n /// grammar.\n minRepeatType?: number\n}\n\n/// Tree buffers contain (type, start, end, endIndex) quads for each\n/// node. In such a buffer, nodes are stored in prefix order (parents\n/// before children, with the endIndex of the parent indicating which\n/// children belong to it)\nexport class TreeBuffer {\n /// Create a tree buffer @internal\n constructor(\n /// @internal\n readonly buffer: Uint16Array,\n /// The total length of the group of nodes in the buffer.\n readonly length: number,\n /// @internal\n readonly set: NodeSet,\n /// An optional repeat node type associated with the buffer.\n readonly type = NodeType.none\n ) {}\n\n /// @internal\n toString() {\n let result: string[] = []\n for (let index = 0; index < this.buffer.length;) {\n result.push(this.childString(index))\n index = this.buffer[index + 3]\n }\n return result.join(\",\")\n }\n\n /// @internal\n childString(index: number): string {\n let id = this.buffer[index], endIndex = this.buffer[index + 3]\n let type = this.set.types[id], result = type.name\n if (/\\W/.test(result) && !type.isError) result = JSON.stringify(result)\n index += 4\n if (endIndex == index) return result\n let children: string[] = []\n while (index < endIndex) {\n children.push(this.childString(index))\n index = this.buffer[index + 3]\n }\n return result + \"(\" + children.join(\",\") + \")\"\n }\n\n /// @internal\n findChild(startIndex: number, endIndex: number, dir: 1 | -1, after: number) {\n let {buffer} = this, pick = -1\n for (let i = startIndex; i != endIndex; i = buffer[i + 3]) {\n if (after != After.None) {\n let start = buffer[i + 1], end = buffer[i + 2]\n if (dir > 0) {\n if (end > after) pick = i\n if (end > after) break\n } else {\n if (start < after) pick = i\n if (end >= after) break\n }\n } else {\n pick = i\n if (dir > 0) break\n }\n }\n return pick\n }\n}\n\nconst enum After { None = -1e8 }\n\n/// A syntax node provides an immutable pointer at a given node in a\n/// tree. When iterating over large amounts of nodes, you may want to\n/// use a mutable [cursor](#tree.TreeCursor) instead, which is more\n/// efficient.\nexport interface SyntaxNode {\n /// The type of the node.\n type: NodeType\n /// The name of the node (`.type.name`).\n name: string\n /// The start position of the node.\n from: number\n /// The end position of the node.\n to: number\n\n /// The node's parent node, if any.\n parent: SyntaxNode | null\n /// The first child, if the node has children.\n firstChild: SyntaxNode | null\n /// The node's last child, if available.\n lastChild: SyntaxNode | null\n /// The first child that starts at or after `pos`.\n childAfter(pos: number): SyntaxNode | null\n /// The last child that ends at or before `pos`.\n childBefore(pos: number): SyntaxNode | null\n /// This node's next sibling, if any.\n nextSibling: SyntaxNode | null\n /// This node's previous sibling.\n prevSibling: SyntaxNode | null\n /// A [tree cursor](#tree.TreeCursor) starting at this node.\n cursor: TreeCursor\n /// Find the node around, before (if `side` is -1), or after (`side`\n /// is 1) the given position. Will look in parent nodes if the\n /// position is outside this node.\n resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode\n\n /// Get the first child of the given type (which may be a [node\n /// name](#tree.NodeProp.name) or a [group\n /// name](#tree.NodeProp^group)). If `before` is non-null, only\n /// return children that occur somewhere after a node with that name\n /// or group. If `after` is non-null, only return children that\n /// occur somewhere before a node with that name or group.\n getChild(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode | null\n\n /// Like [`getChild`](#tree.SyntaxNode.getChild), but return all\n /// matching children, not just the first.\n getChildren(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode[]\n}\n\nclass TreeNode implements SyntaxNode {\n constructor(readonly node: Tree,\n readonly from: number,\n readonly index: number,\n readonly _parent: TreeNode | null) {}\n\n get type() { return this.node.type }\n\n get name() { return this.node.type.name }\n\n get to() { return this.from + this.node.length }\n\n nextChild(i: number, dir: 1 | -1, after: number, full = false): TreeNode | BufferNode | null {\n for (let parent: TreeNode = this;;) {\n for (let {children, positions} = parent.node, e = dir > 0 ? children.length : -1; i != e; i += dir) {\n let next = children[i], start = positions[i] + parent.from\n if (after != After.None && (dir < 0 ? start >= after : start + next.length <= after))\n continue\n if (next instanceof TreeBuffer) {\n let index = next.findChild(0, next.buffer.length, dir, after == After.None ? After.None : after - start)\n if (index > -1) return new BufferNode(new BufferContext(parent, next, i, start), null, index)\n } else if (full || (!next.type.isAnonymous || hasChild(next))) {\n let inner = new TreeNode(next, start, i, parent)\n return full || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, after)\n }\n }\n if (full || !parent.type.isAnonymous) return null\n i = parent.index + dir\n parent = parent._parent!\n if (!parent) return null\n }\n }\n\n get firstChild() { return this.nextChild(0, 1, After.None) }\n get lastChild() { return this.nextChild(this.node.children.length - 1, -1, After.None) }\n\n childAfter(pos: number) { return this.nextChild(0, 1, pos) }\n childBefore(pos: number) { return this.nextChild(this.node.children.length - 1, -1, pos) }\n\n nextSignificantParent() {\n let val: TreeNode = this\n while (val.type.isAnonymous && val._parent) val = val._parent\n return val\n }\n\n get parent() {\n return this._parent ? this._parent.nextSignificantParent() : null\n }\n\n get nextSibling() {\n return this._parent ? this._parent.nextChild(this.index + 1, 1, -1) : null\n }\n get prevSibling() {\n return this._parent ? this._parent.nextChild(this.index - 1, -1, -1) : null\n }\n\n get cursor() { return new TreeCursor(this) }\n\n resolve(pos: number, side: -1 | 0 | 1 = 0) {\n return this.cursor.moveTo(pos, side).node\n }\n\n getChild(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n let r = getChildren(this, type, before, after)\n return r.length ? r[0] : null\n }\n\n getChildren(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n return getChildren(this, type, before, after)\n }\n\n /// @internal\n toString() { return this.node.toString() }\n}\n\nfunction getChildren(node: SyntaxNode, type: string | number, before: string | number | null, after: string | number | null): SyntaxNode[] {\n let cur = node.cursor, result: SyntaxNode[] = []\n if (!cur.firstChild()) return result\n if (before != null) while (!cur.type.is(before)) if (!cur.nextSibling()) return result\n for (;;) {\n if (after != null && cur.type.is(after)) return result\n if (cur.type.is(type)) result.push(cur.node)\n if (!cur.nextSibling()) return after == null ? result : []\n }\n}\n\nclass BufferContext {\n constructor(readonly parent: TreeNode,\n readonly buffer: TreeBuffer,\n readonly index: number,\n readonly start: number) {}\n}\n\nclass BufferNode implements SyntaxNode {\n type: NodeType\n\n get name() { return this.type.name }\n\n get from() { return this.context.start + this.context.buffer.buffer[this.index + 1] }\n\n get to() { return this.context.start + this.context.buffer.buffer[this.index + 2] }\n\n constructor(readonly context: BufferContext,\n readonly _parent: BufferNode | null,\n readonly index: number) {\n this.type = context.buffer.set.types[context.buffer.buffer[index]]\n }\n\n child(dir: 1 | -1, after: number): BufferNode | null {\n let {buffer} = this.context\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir,\n after == After.None ? After.None : after - this.context.start)\n return index < 0 ? null : new BufferNode(this.context, this, index)\n }\n\n get firstChild() { return this.child(1, After.None) }\n get lastChild() { return this.child(-1, After.None) }\n\n childAfter(pos: number) { return this.child(1, pos) }\n childBefore(pos: number) { return this.child(-1, pos) }\n\n get parent() {\n return this._parent || this.context.parent.nextSignificantParent()\n }\n\n externalSibling(dir: 1 | -1) {\n return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, -1)\n }\n\n get nextSibling(): SyntaxNode | null {\n let {buffer} = this.context\n let after = buffer.buffer[this.index + 3]\n if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))\n return new BufferNode(this.context, this._parent, after)\n return this.externalSibling(1)\n }\n\n get prevSibling(): SyntaxNode | null {\n let {buffer} = this.context\n let parentStart = this._parent ? this._parent.index + 4 : 0\n if (this.index == parentStart) return this.externalSibling(-1)\n return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, After.None))\n }\n\n get cursor() { return new TreeCursor(this) }\n\n resolve(pos: number, side: -1 | 0 | 1 = 0) {\n return this.cursor.moveTo(pos, side).node\n }\n\n /// @internal\n toString() { return this.context.buffer.childString(this.index) }\n\n getChild(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n let r = getChildren(this, type, before, after)\n return r.length ? r[0] : null\n }\n\n getChildren(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n return getChildren(this, type, before, after)\n }\n}\n\n/// A tree cursor object focuses on a given node in a syntax tree, and\n/// allows you to move to adjacent nodes.\nexport class TreeCursor {\n /// The node's type.\n type!: NodeType\n\n /// Shorthand for `.type.name`.\n get name() { return this.type.name }\n\n /// The start source offset of this node.\n from!: number\n\n /// The end source offset.\n to!: number\n\n /// @internal\n _tree!: TreeNode\n private buffer: BufferContext | null = null\n private stack: number[] = []\n private index: number = 0\n private bufferNode: BufferNode | null = null\n\n /// @internal\n constructor(node: TreeNode | BufferNode, readonly full = false) {\n if (node instanceof TreeNode) {\n this.yieldNode(node)\n } else {\n this._tree = node.context.parent\n this.buffer = node.context\n for (let n: BufferNode | null = node._parent; n; n = n._parent) this.stack.unshift(n.index)\n this.bufferNode = node\n this.yieldBuf(node.index)\n }\n }\n\n private yieldNode(node: TreeNode | null) {\n if (!node) return false\n this._tree = node\n this.type = node.type\n this.from = node.from\n this.to = node.to\n return true\n }\n\n private yieldBuf(index: number, type?: NodeType) {\n this.index = index\n let {start, buffer} = this.buffer!\n this.type = type || buffer.set.types[buffer.buffer[index]]\n this.from = start + buffer.buffer[index + 1]\n this.to = start + buffer.buffer[index + 2]\n return true\n }\n\n private yield(node: TreeNode | BufferNode | null) {\n if (!node) return false\n if (node instanceof TreeNode) {\n this.buffer = null\n return this.yieldNode(node)\n }\n this.buffer = node.context\n return this.yieldBuf(node.index, node.type)\n }\n\n /// @internal\n toString() {\n return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString()\n }\n\n /// @internal\n enter(dir: 1 | -1, after: number) {\n if (!this.buffer)\n return this.yield(this._tree.nextChild(dir < 0 ? this._tree.node.children.length - 1 : 0, dir, after, this.full))\n\n let {buffer} = this.buffer\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir,\n after == After.None ? After.None : after - this.buffer.start)\n if (index < 0) return false\n this.stack.push(this.index)\n return this.yieldBuf(index)\n }\n\n /// Move the cursor to this node's first child. When this returns\n /// false, the node has no child, and the cursor has not been moved.\n firstChild() { return this.enter(1, After.None) }\n\n /// Move the cursor to this node's last child.\n lastChild() { return this.enter(-1, After.None) }\n\n /// Move the cursor to the first child that starts at or after `pos`.\n childAfter(pos: number) { return this.enter(1, pos) }\n\n /// Move to the last child that ends at or before `pos`.\n childBefore(pos: number) { return this.enter(-1, pos) }\n\n /// Move the node's parent node, if this isn't the top node.\n parent() {\n if (!this.buffer) return this.yieldNode(this.full ? this._tree._parent : this._tree.parent)\n if (this.stack.length) return this.yieldBuf(this.stack.pop()!)\n let parent = this.full ? this.buffer.parent : this.buffer.parent.nextSignificantParent()\n this.buffer = null\n return this.yieldNode(parent)\n }\n\n /// @internal\n sibling(dir: 1 | -1) {\n if (!this.buffer)\n return !this._tree._parent ? false\n : this.yield(this._tree._parent.nextChild(this._tree.index + dir, dir, After.None, this.full))\n\n let {buffer} = this.buffer, d = this.stack.length - 1\n if (dir < 0) {\n let parentStart = d < 0 ? 0 : this.stack[d] + 4\n if (this.index != parentStart)\n return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, After.None))\n } else {\n let after = buffer.buffer[this.index + 3]\n if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))\n return this.yieldBuf(after)\n }\n return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, After.None, this.full)) : false\n }\n\n /// Move to this node's next sibling, if any.\n nextSibling() { return this.sibling(1) }\n\n /// Move to this node's previous sibling, if any.\n prevSibling() { return this.sibling(-1) }\n\n private atLastNode(dir: 1 | -1) {\n let index, parent: TreeNode | null, {buffer} = this\n if (buffer) {\n if (dir > 0) {\n if (this.index < buffer.buffer.buffer.length) return false\n } else {\n for (let i = 0; i < this.index; i++) if (buffer.buffer.buffer[i + 3] < this.index) return false\n }\n ;({index, parent} = buffer)\n } else {\n ({index, _parent: parent} = this._tree)\n }\n for (; parent; {index, _parent: parent} = parent) {\n for (let i = index + dir, e = dir < 0 ? -1 : parent.node.children.length; i != e; i += dir) {\n let child = parent.node.children[i]\n if (this.full || !child.type.isAnonymous || child instanceof TreeBuffer || hasChild(child)) return false\n }\n }\n return true\n }\n\n private move(dir: 1 | -1) {\n if (this.enter(dir, After.None)) return true\n for (;;) {\n if (this.sibling(dir)) return true\n if (this.atLastNode(dir) || !this.parent()) return false\n }\n }\n\n /// Move to the next node in a\n /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR))\n /// traversal, going from a node to its first child or, if the\n /// current node is empty, its next sibling or the next sibling of\n /// the first parent node that has one.\n next() { return this.move(1) }\n\n /// Move to the next node in a last-to-first pre-order traveral. A\n /// node is followed by ist last child or, if it has none, its\n /// previous sibling or the previous sibling of the first parent\n /// node that has one.\n prev() { return this.move(-1) }\n\n /// Move the cursor to the innermost node that covers `pos`. If\n /// `side` is -1, it will enter nodes that end at `pos`. If it is 1,\n /// it will enter nodes that start at `pos`.\n moveTo(pos: number, side: -1 | 0 | 1 = 0) {\n // Move up to a node that actually holds the position, if possible\n while (this.from == this.to ||\n (side < 1 ? this.from >= pos : this.from > pos) ||\n (side > -1 ? this.to <= pos : this.to < pos))\n if (!this.parent()) break\n\n // Then scan down into child nodes as far as possible\n for (;;) {\n if (side < 0 ? !this.childBefore(pos) : !this.childAfter(pos)) break\n if (this.from == this.to ||\n (side < 1 ? this.from >= pos : this.from > pos) ||\n (side > -1 ? this.to <= pos : this.to < pos)) {\n this.parent()\n break\n }\n }\n return this\n }\n\n /// Get a [syntax node](#tree.SyntaxNode) at the cursor's current\n /// position.\n get node(): SyntaxNode {\n if (!this.buffer) return this._tree\n \n let cache = this.bufferNode, result: BufferNode | null = null, depth = 0\n if (cache && cache.context == this.buffer) {\n scan: for (let index = this.index, d = this.stack.length; d >= 0;) {\n for (let c: BufferNode | null = cache; c; c = c._parent) if (c.index == index) {\n if (index == this.index) return c\n result = c\n depth = d + 1\n break scan\n }\n index = this.stack[--d]\n }\n }\n for (let i = depth; i < this.stack.length; i++) result = new BufferNode(this.buffer, result, this.stack[i])\n return this.bufferNode = new BufferNode(this.buffer, result, this.index)\n }\n\n /// Get the [tree](#tree.Tree) that represents the current node, if\n /// any. Will return null when the node is in a [tree\n /// buffer](#tree.TreeBuffer).\n get tree(): Tree | null {\n return this.buffer ? null : this._tree.node\n }\n}\n\nfunction hasChild(tree: Tree): boolean {\n return tree.children.some(ch => !ch.type.isAnonymous || ch instanceof TreeBuffer || hasChild(ch))\n}\n\n/// This is used by `Tree.build` as an abstraction for iterating over\n/// a tree buffer. A cursor initially points at the very last element\n/// in the buffer. Every time `next()` is called it moves on to the\n/// previous one.\nexport interface BufferCursor {\n /// The current buffer position (four times the number of nodes\n /// remaining).\n pos: number\n /// The node ID of the next node in the buffer.\n id: number\n /// The start position of the next node in the buffer.\n start: number\n /// The end position of the next node.\n end: number\n /// The size of the next node (the number of nodes inside, counting\n /// the node itself, times 4).\n size: number\n /// Moves `this.pos` down by 4.\n next(): void\n /// Create a copy of this cursor.\n fork(): BufferCursor\n}\n\nclass FlatBufferCursor implements BufferCursor {\n constructor(readonly buffer: readonly number[], public index: number) {}\n\n get id() { return this.buffer[this.index - 4] }\n get start() { return this.buffer[this.index - 3] }\n get end() { return this.buffer[this.index - 2] }\n get size() { return this.buffer[this.index - 1] }\n\n get pos() { return this.index }\n\n next() { this.index -= 4 }\n\n fork() { return new FlatBufferCursor(this.buffer, this.index) }\n}\n\nconst BalanceBranchFactor = 8\n\nfunction buildTree(data: BuildData) {\n let {buffer, nodeSet, topID = 0,\n maxBufferLength = DefaultBufferLength,\n reused = [],\n minRepeatType = nodeSet.types.length} = data as BuildData\n let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer as BufferCursor\n let types = nodeSet.types\n\n let contextHash = 0\n\n function takeNode(parentStart: number, minPos: number,\n children: (Tree | TreeBuffer)[], positions: number[],\n inRepeat: number) {\n let {id, start, end, size} = cursor\n let startPos = start - parentStart\n if (size < 0) {\n if (size == -1) { // Reused node\n children.push(reused[id])\n positions.push(startPos)\n } else { // Context change\n contextHash = id\n }\n cursor.next()\n return\n }\n\n let type = types[id], node, buffer: {size: number, start: number, skip: number} | undefined\n if (end - start <= maxBufferLength && (buffer = findBufferSize(cursor.pos - minPos, inRepeat))) {\n // Small enough for a buffer, and no reused nodes inside\n let data = new Uint16Array(buffer.size - buffer.skip)\n let endPos = cursor.pos - buffer.size, index = data.length\n while (cursor.pos > endPos)\n index = copyToBuffer(buffer.start, data, index, inRepeat)\n node = new TreeBuffer(data, end - buffer.start, nodeSet, inRepeat < 0 ? NodeType.none : types[inRepeat])\n startPos = buffer.start - parentStart\n } else { // Make it a node\n let endPos = cursor.pos - size\n cursor.next()\n let localChildren: (Tree | TreeBuffer)[] = [], localPositions: number[] = []\n let localInRepeat = id >= minRepeatType ? id : -1\n while (cursor.pos > endPos) {\n if (cursor.id == localInRepeat) cursor.next()\n else takeNode(start, endPos, localChildren, localPositions, localInRepeat)\n }\n localChildren.reverse(); localPositions.reverse()\n\n if (localInRepeat > -1 && localChildren.length > BalanceBranchFactor)\n node = balanceRange(type, type, localChildren, localPositions, 0, localChildren.length, 0, maxBufferLength,\n end - start, contextHash)\n else\n node = withHash(new Tree(type, localChildren, localPositions, end - start), contextHash)\n }\n\n children.push(node)\n positions.push(startPos)\n }\n\n function findBufferSize(maxSize: number, inRepeat: number) {\n // Scan through the buffer to find previous siblings that fit\n // together in a TreeBuffer, and don't contain any reused nodes\n // (which can't be stored in a buffer).\n // If `inRepeat` is > -1, ignore node boundaries of that type for\n // nesting, but make sure the end falls either at the start\n // (`maxSize`) or before such a node.\n let fork = cursor.fork()\n let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength\n let result = {size: 0, start: 0, skip: 0}\n scan: for (let minPos = fork.pos - maxSize; fork.pos > minPos;) {\n // Pretend nested repeat nodes of the same type don't exist\n if (fork.id == inRepeat) {\n // Except that we store the current state as a valid return\n // value.\n result.size = size; result.start = start; result.skip = skip\n skip += 4; size += 4\n fork.next()\n continue\n }\n let nodeSize = fork.size, startPos = fork.pos - nodeSize\n if (nodeSize < 0 || startPos < minPos || fork.start < minStart) break\n let localSkipped = fork.id >= minRepeatType ? 4 : 0\n let nodeStart = fork.start\n fork.next()\n while (fork.pos > startPos) {\n if (fork.size < 0) break scan\n if (fork.id >= minRepeatType) localSkipped += 4\n fork.next()\n }\n start = nodeStart\n size += nodeSize\n skip += localSkipped\n }\n if (inRepeat < 0 || size == maxSize) {\n result.size = size; result.start = start; result.skip = skip\n }\n return result.size > 4 ? result : undefined\n }\n\n function copyToBuffer(bufferStart: number, buffer: Uint16Array, index: number, inRepeat: number): number {\n let {id, start, end, size} = cursor\n cursor.next()\n if (id == inRepeat) return index\n let startIndex = index\n if (size > 4) {\n let endPos = cursor.pos - (size - 4)\n while (cursor.pos > endPos)\n index = copyToBuffer(bufferStart, buffer, index, inRepeat)\n }\n if (id < minRepeatType) { // Don't copy repeat nodes into buffers\n buffer[--index] = startIndex\n buffer[--index] = end - bufferStart\n buffer[--index] = start - bufferStart\n buffer[--index] = id\n }\n return index\n }\n\n let children: (Tree | TreeBuffer)[] = [], positions: number[] = []\n while (cursor.pos > 0) takeNode(data.start || 0, 0, children, positions, -1)\n let length = data.length ?? (children.length ? positions[0] + children[0].length : 0)\n return new Tree(types[topID], children.reverse(), positions.reverse(), length)\n}\n\nfunction balanceRange(outerType: NodeType, innerType: NodeType,\n children: readonly (Tree | TreeBuffer)[], positions: readonly number[],\n from: number, to: number,\n start: number, maxBufferLength: number,\n length: number, contextHash: number): Tree {\n let localChildren: (Tree | TreeBuffer)[] = [], localPositions: number[] = []\n if (length <= maxBufferLength) {\n for (let i = from; i < to; i++) {\n localChildren.push(children[i])\n localPositions.push(positions[i] - start)\n }\n } else {\n let maxChild = Math.max(maxBufferLength, Math.ceil(length * 1.5 / BalanceBranchFactor))\n for (let i = from; i < to;) {\n let groupFrom = i, groupStart = positions[i]\n i++\n for (; i < to; i++) {\n let nextEnd = positions[i] + children[i].length\n if (nextEnd - groupStart > maxChild) break\n }\n if (i == groupFrom + 1) {\n let only = children[groupFrom]\n if (only instanceof Tree && only.type == innerType && only.length > maxChild << 1) { // Too big, collapse\n for (let j = 0; j < only.children.length; j++) {\n localChildren.push(only.children[j])\n localPositions.push(only.positions[j] + groupStart - start)\n }\n continue\n }\n localChildren.push(only)\n } else if (i == groupFrom + 1) {\n localChildren.push(children[groupFrom])\n } else {\n let inner = balanceRange(innerType, innerType, children, positions, groupFrom, i, groupStart,\n maxBufferLength, positions[i - 1] + children[i - 1].length - groupStart, contextHash)\n if (innerType != NodeType.none && !containsType(inner.children, innerType))\n inner = withHash(new Tree(NodeType.none, inner.children, inner.positions, inner.length), contextHash)\n localChildren.push(inner)\n }\n localPositions.push(groupStart - start)\n }\n }\n return withHash(new Tree(outerType, localChildren, localPositions, length), contextHash)\n}\n\nfunction containsType(nodes: readonly (Tree | TreeBuffer)[], type: NodeType) {\n for (let elt of nodes) if (elt.type == type) return true\n return false\n}\n\n/// The [`TreeFragment.applyChanges`](#tree.TreeFragment^applyChanges)\n/// method expects changed ranges in this format.\nexport interface ChangedRange {\n /// The start of the change in the start document\n fromA: number\n /// The end of the change in the start document\n toA: number\n /// The start of the replacement in the new document\n fromB: number\n /// The end of the replacement in the new document\n toB: number\n}\n\nconst enum Open { Start = 1, End = 2 }\n\n/// Tree fragments are used during [incremental\n/// parsing](#lezer.ParseOptions.fragments) to track parts of old\n/// trees that can be reused in a new parse. An array of fragments is\n/// used to track regions of an old tree whose nodes might be reused\n/// in new parses. Use the static\n/// [`applyChanges`](#tree.TreeFragment^applyChanges) method to update\n/// fragments for document changes.\nexport class TreeFragment {\n constructor(\n /// The start of the unchanged range pointed to by this fragment.\n /// This refers to an offset in the _updated_ document (as opposed\n /// to the original tree).\n readonly from: number,\n /// The end of the unchanged range.\n readonly to: number,\n /// The tree that this fragment is based on.\n readonly tree: Tree,\n /// The offset between the fragment's tree and the document that\n /// this fragment can be used against. Add this when going from\n /// document to tree positions, subtract it to go from tree to\n /// document positions.\n readonly offset: number,\n private open: number\n ) {}\n\n get openStart() { return (this.open & Open.Start) > 0 }\n\n get openEnd() { return (this.open & Open.End) > 0 }\n\n /// Apply a set of edits to an array of fragments, removing or\n /// splitting fragments as necessary to remove edited ranges, and\n /// adjusting offsets for fragments that moved.\n static applyChanges(fragments: readonly TreeFragment[], changes: readonly ChangedRange[], minGap = 128) {\n if (!changes.length) return fragments\n let result: TreeFragment[] = []\n let fI = 1, nextF = fragments.length ? fragments[0] : null\n for (let cI = 0, pos = 0, off = 0;; cI++) {\n let nextC = cI < changes.length ? changes[cI] : null\n let nextPos = nextC ? nextC.fromA : 1e9\n if (nextPos - pos >= minGap) while (nextF && nextF.from < nextPos) {\n let cut: TreeFragment | null = nextF\n if (pos >= cut.from || nextPos <= cut.to || off) {\n let fFrom = Math.max(cut.from, pos) - off, fTo = Math.min(cut.to, nextPos) - off\n cut = fFrom >= fTo ? null :\n new TreeFragment(fFrom, fTo, cut.tree, cut.offset + off,\n (cI > 0 ? Open.Start : 0) | (nextC ? Open.End : 0))\n }\n if (cut) result.push(cut)\n if (nextF.to > nextPos) break\n nextF = fI < fragments.length ? fragments[fI++] : null\n }\n if (!nextC) break\n pos = nextC.toA\n off = nextC.toA - nextC.toB\n }\n return result\n }\n\n /// Create a set of fragments from a freshly parsed tree, or update\n /// an existing set of fragments by replacing the ones that overlap\n /// with a tree with content from the new tree. When `partial` is\n /// true, the parse is treated as incomplete, and the token at its\n /// end is not included in [`safeTo`](#tree.TreeFragment.safeTo).\n static addTree(tree: Tree, fragments: readonly TreeFragment[] = [], partial = false) {\n let result = [new TreeFragment(0, tree.length, tree, 0, partial ? Open.End : 0)]\n for (let f of fragments) if (f.to > tree.length) result.push(f)\n return result\n }\n}\n\n/// Interface used to represent an in-progress parse, which can be\n/// moved forward piece-by-piece.\nexport interface PartialParse {\n /// Advance the parse state by some amount.\n advance(): Tree | null\n /// The current parse position.\n pos: number\n /// Get the currently parsed content as a tree, even though the\n /// parse hasn't finished yet.\n forceFinish(): Tree\n}\n\n/// A parse context is an object providing additional information to the\n/// parser. It is passed through to nested parsers.\nexport interface ParseContext {\n /// A set of fragments from a previous parse to be used for incremental\n /// parsing. These should be aligned with the current document\n /// (through a call to\n /// [`TreeFragment.applyChanges`](#tree.TreeFragment^applyChanges))\n /// if any changes were made since they were produced. The parser\n /// will try to reuse nodes from the fragments in the new parse,\n /// greatly speeding up the parse when it can do so for most of the\n /// document.\n fragments?: readonly TreeFragment[]\n}\n\n/// This is the interface the parser uses to access the document. It\n/// exposes a sequence of UTF16 code units. Most (but not _all_)\n/// access, especially through `get`, will be sequential, so\n/// implementations can optimize for that.\nexport interface Input {\n /// The end of the stream.\n length: number\n /// Get the code unit at the given position. Will return -1 when\n /// asked for a point below 0 or beyond the end of the stream.\n get(pos: number): number\n /// Returns the string between `pos` and the next newline character\n /// or the end of the document. Not used by the built-in tokenizers,\n /// but can be useful in custom tokenizers or completely custom\n /// parsers.\n lineAfter(pos: number): string\n /// Read part of the stream as a string\n read(from: number, to: number): string\n /// Return a new `Input` over the same data, but with a lower\n /// `length`. Used, for example, when nesting grammars to give the\n /// inner grammar a narrower view of the input.\n clip(at: number): Input\n}\n\n// Creates an `Input` that is backed by a single, flat string.\nexport function stringInput(input: string): Input { return new StringInput(input) }\n\nclass StringInput implements Input {\n constructor(readonly string: string, readonly length = string.length) {}\n\n get(pos: number) {\n return pos < 0 || pos >= this.length ? -1 : this.string.charCodeAt(pos)\n }\n\n lineAfter(pos: number) {\n if (pos < 0) return \"\"\n let end = this.string.indexOf(\"\\n\", pos)\n return this.string.slice(pos, end < 0 ? this.length : Math.min(end, this.length))\n }\n \n read(from: number, to: number): string { return this.string.slice(from, Math.min(this.length, to)) }\n\n clip(at: number) { return new StringInput(this.string, at) }\n}\n"],"names":[],"mappings":"AAAA;MACa,mBAAmB,GAAG,KAAI;AAEvC,IAAI,UAAU,GAAG,CAAC,CAAA;AAElB,MAAM,UAAU,GAAG,IAAI,OAAO,EAAkB,CAAA;AAEhD;AACA;MACa,QAAQ;;;IAWnB,YAAY,EAAC,WAAW,KAAwC,EAAE;QAChE,IAAI,CAAC,EAAE,GAAG,UAAU,EAAE,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,WAAW,KAAK;YACjC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;SACxE,CAAC,CAAA;KACH;;;IAID,OAAO,MAAM,KAAK,OAAO,IAAI,QAAQ,CAAS,EAAC,WAAW,EAAE,GAAG,IAAI,GAAG,EAAC,CAAC,CAAA,EAAE;;;IAI1E,OAAO,MAAM,KAAK,OAAO,IAAI,QAAQ,CAAS,EAAC,WAAW,EAAE,MAAM,EAAC,CAAC,CAAA,EAAE;;;IAItE,OAAO,IAAI,KAAK,OAAO,IAAI,QAAQ,CAAU,EAAC,WAAW,EAAE,MAAM,IAAI,EAAC,CAAC,CAAA,EAAE;;;;;IAMzE,GAAG,CAAC,OAA8B,EAAE,KAAQ;QAC1C,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA;QACxB,OAAO,OAAO,CAAA;KACf;;;;;;;;IASD,GAAG,CAAC,KAAoE;QACtE,IAAI,OAAO,KAAK,IAAI,UAAU;YAAE,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC7D,OAAO,CAAC,IAAI;YACV,IAAI,MAAM,GAAI,KAA2C,CAAC,IAAI,CAAC,CAAA;YAC/D,OAAO,MAAM,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|
1
|
+
{"version":3,"file":"tree.es.js","sources":["../src/tree.ts"],"sourcesContent":["import {Parser} from \"./parse\"\n\n// FIXME profile adding a per-Tree TreeNode cache, validating it by\n// parent pointer\n\n/// The default maximum length of a `TreeBuffer` node (1024).\nexport const DefaultBufferLength = 1024\n\nlet nextPropID = 0\n\nexport class Range {\n constructor(readonly from: number, readonly to: number) {}\n}\n\n/// Each [node type](#common.NodeType) or [individual tree](#common.Tree)\n/// can have metadata associated with it in props. Instances of this\n/// class represent prop names.\nexport class NodeProp<T> {\n /// @internal\n id: number\n\n /// Indicates whether this prop is stored per [node\n /// type](#common.NodeType) or per [tree node](#common.Tree).\n perNode: boolean\n\n /// A method that deserializes a value of this prop from a string.\n /// Can be used to allow a prop to be directly written in a grammar\n /// file.\n deserialize: (str: string) => T\n\n /// Create a new node prop type.\n constructor(config: {\n /// The [deserialize](#common.NodeProp.deserialize) function to use\n /// for this prop. Defaults to a funciton that raises an error.\n deserialize?: (str: string) => T,\n /// By default, node props are stored in the [node\n /// type](#common.NodeType). It can sometimes be useful to directly\n /// store information (usually related to the parsing algorithm)\n /// in [nodes](#common.Tree) themselves. Set this to true to enable\n /// that for this prop.\n perNode?: boolean\n } = {}) {\n this.id = nextPropID++\n this.perNode = !!config.perNode\n this.deserialize = config.deserialize || (() => {\n throw new Error(\"This node type doesn't define a deserialize function\")\n })\n }\n\n /// This is meant to be used with\n /// [`NodeSet.extend`](#common.NodeSet.extend) or\n /// [`LRParser.configure`](#lr.ParserConfig.props) to compute\n /// prop values for each node type in the set. Takes a [match\n /// object](#common.NodeType^match) or function that returns undefined\n /// if the node type doesn't get this prop, and the prop's value if\n /// it does.\n add(match: {[selector: string]: T} | ((type: NodeType) => T | undefined)): NodePropSource {\n if (this.perNode) throw new RangeError(\"Can't add per-node props to node types\")\n if (typeof match != \"function\") match = NodeType.match(match)\n return (type) => {\n let result = (match as (type: NodeType) => T | undefined)(type)\n return result === undefined ? null : [this, result]\n }\n }\n\n /// Prop that is used to describe matching delimiters. For opening\n /// delimiters, this holds an array of node names (written as a\n /// space-separated string when declaring this prop in a grammar)\n /// for the node types of closing delimiters that match it.\n static closedBy = new NodeProp<readonly string[]>({deserialize: str => str.split(\" \")})\n\n /// The inverse of [`closedBy`](#common.NodeProp^closedBy). This is\n /// attached to closing delimiters, holding an array of node names\n /// of types of matching opening delimiters.\n static openedBy = new NodeProp<readonly string[]>({deserialize: str => str.split(\" \")})\n\n /// Used to assign node types to groups (for example, all node\n /// types that represent an expression could be tagged with an\n /// `\"Expression\"` group).\n static group = new NodeProp<readonly string[]>({deserialize: str => str.split(\" \")})\n\n /// The hash of the [context](#lr.ContextTracker.constructor)\n /// that the node was parsed in, if any. Used to limit reuse of\n /// contextual nodes.\n static contextHash = new NodeProp<number>({perNode: true})\n\n /// The distance beyond the end of the node that the tokenizer\n /// looked ahead for any of the tokens inside the node. (The LR\n /// parser only stores this when it is larger than 25, for\n /// efficiency reasons.)\n static lookAhead = new NodeProp<number>({perNode: true})\n\n /// This per-node prop is used to replace a given node, or part of a\n /// node, with another tree. This is useful to include trees from\n /// different languages.\n static mounted = new NodeProp<MountedTree>({perNode: true})\n}\n\n/// A mounted tree, which can be [stored](#common.NodeProp^mounted) on\n/// a tree node to indicate that parts of its content are\n/// represented by another tree.\nexport class MountedTree {\n constructor(\n /// The inner tree.\n readonly tree: Tree,\n /// If this is null, this tree replaces the entire node (it will\n /// be included in the regular iteration instead of its host\n /// node). If not, only the given ranges are considered to be\n /// covered by this tree. This is used for trees that are mixed in\n /// a way that isn't strictly hierarchical. Such mounted trees are\n /// only entered by [`resolveInner`](#common.Tree.resolveInner)\n /// and [`enter`](#common.SyntaxNode.enter).\n readonly overlay: readonly {from: number, to: number}[] | null,\n /// The parser used to create this subtree.\n readonly parser: Parser\n ) {}\n}\n\n/// Type returned by [`NodeProp.add`](#common.NodeProp.add). Describes\n/// whether a prop should be added to a given node type in a node set,\n/// and what value it should have.\nexport type NodePropSource = (type: NodeType) => null | [NodeProp<any>, any]\n\n// Note: this is duplicated in lr/src/constants.ts\nconst enum NodeFlag {\n Top = 1,\n Skipped = 2,\n Error = 4,\n Anonymous = 8\n}\n\nconst noProps: {[propID: number]: any} = Object.create(null)\n\n/// Each node in a syntax tree has a node type associated with it.\nexport class NodeType {\n /// @internal\n constructor(\n /// The name of the node type. Not necessarily unique, but if the\n /// grammar was written properly, different node types with the\n /// same name within a node set should play the same semantic\n /// role.\n readonly name: string,\n /// @internal\n readonly props: {readonly [prop: number]: any},\n /// The id of this node in its set. Corresponds to the term ids\n /// used in the parser.\n readonly id: number,\n /// @internal\n readonly flags: number = 0) {}\n\n static define(spec: {\n /// The ID of the node type. When this type is used in a\n /// [set](#common.NodeSet), the ID must correspond to its index in\n /// the type array.\n id: number, \n /// The name of the node type. Leave empty to define an anonymous\n /// node.\n name?: string,\n /// [Node props](#common.NodeProp) to assign to the type. The value\n /// given for any given prop should correspond to the prop's type.\n props?: readonly ([NodeProp<any>, any] | NodePropSource)[],\n /// Whether this is a [top node](#common.NodeType.isTop).\n top?: boolean,\n /// Whether this node counts as an [error\n /// node](#common.NodeType.isError).\n error?: boolean,\n /// Whether this node is a [skipped](#common.NodeType.isSkipped)\n /// node.\n skipped?: boolean\n }) {\n let props = spec.props && spec.props.length ? Object.create(null) : noProps\n let flags = (spec.top ? NodeFlag.Top : 0) | (spec.skipped ? NodeFlag.Skipped : 0) |\n (spec.error ? NodeFlag.Error : 0) | (spec.name == null ? NodeFlag.Anonymous : 0)\n let type = new NodeType(spec.name || \"\", props, spec.id, flags)\n if (spec.props) for (let src of spec.props) {\n if (!Array.isArray(src)) src = src(type)!\n if (src) {\n if (src[0].perNode) throw new RangeError(\"Can't store a per-node prop on a node type\")\n props[src[0].id] = src[1]\n }\n }\n return type\n }\n\n /// Retrieves a node prop for this type. Will return `undefined` if\n /// the prop isn't present on this node.\n prop<T>(prop: NodeProp<T>): T | undefined { return this.props[prop.id] }\n\n /// True when this is the top node of a grammar.\n get isTop() { return (this.flags & NodeFlag.Top) > 0 }\n\n /// True when this node is produced by a skip rule.\n get isSkipped() { return (this.flags & NodeFlag.Skipped) > 0 }\n\n /// Indicates whether this is an error node.\n get isError() { return (this.flags & NodeFlag.Error) > 0 }\n\n /// When true, this node type doesn't correspond to a user-declared\n /// named node, for example because it is used to cache repetition.\n get isAnonymous() { return (this.flags & NodeFlag.Anonymous) > 0 }\n\n /// Returns true when this node's name or one of its\n /// [groups](#common.NodeProp^group) matches the given string.\n is(name: string | number) {\n if (typeof name == 'string') {\n if (this.name == name) return true\n let group = this.prop(NodeProp.group)\n return group ? group.indexOf(name) > -1 : false\n }\n return this.id == name\n }\n\n /// An empty dummy node type to use when no actual type is available.\n static none: NodeType = new NodeType(\"\", Object.create(null), 0, NodeFlag.Anonymous)\n\n /// Create a function from node types to arbitrary values by\n /// specifying an object whose property names are node or\n /// [group](#common.NodeProp^group) names. Often useful with\n /// [`NodeProp.add`](#common.NodeProp.add). You can put multiple\n /// names, separated by spaces, in a single property name to map\n /// multiple node names to a single value.\n static match<T>(map: {[selector: string]: T}): (node: NodeType) => T | undefined {\n let direct = Object.create(null)\n for (let prop in map)\n for (let name of prop.split(\" \")) direct[name] = map[prop]\n return (node: NodeType) => {\n for (let groups = node.prop(NodeProp.group), i = -1; i < (groups ? groups.length : 0); i++) {\n let found = direct[i < 0 ? node.name : groups![i]]\n if (found) return found\n }\n }\n }\n}\n\n/// A node set holds a collection of node types. It is used to\n/// compactly represent trees by storing their type ids, rather than a\n/// full pointer to the type object, in a numeric array. Each parser\n/// [has](#lr.LRParser.nodeSet) a node set, and [tree\n/// buffers](#common.TreeBuffer) can only store collections of nodes\n/// from the same set. A set can have a maximum of 2**16 (65536) node\n/// types in it, so that the ids fit into 16-bit typed array slots.\nexport class NodeSet {\n /// Create a set with the given types. The `id` property of each\n /// type should correspond to its position within the array.\n constructor(\n /// The node types in this set, by id.\n readonly types: readonly NodeType[]\n ) {\n for (let i = 0; i < types.length; i++) if (types[i].id != i)\n throw new RangeError(\"Node type ids should correspond to array positions when creating a node set\")\n }\n\n /// Create a copy of this set with some node properties added. The\n /// arguments to this method should be created with\n /// [`NodeProp.add`](#common.NodeProp.add).\n extend(...props: NodePropSource[]): NodeSet {\n let newTypes: NodeType[] = []\n for (let type of this.types) {\n let newProps: null | {[id: number]: any} = null\n for (let source of props) {\n let add = source(type)\n if (add) {\n if (!newProps) newProps = Object.assign({}, type.props)\n newProps[add[0].id] = add[1]\n }\n }\n newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type)\n }\n return new NodeSet(newTypes)\n }\n}\n\nconst CachedNode = new WeakMap<Tree, TreeNode>()\n\n/// A piece of syntax tree. There are two ways to approach these\n/// trees: the way they are actually stored in memory, and the\n/// convenient way.\n///\n/// Syntax trees are stored as a tree of `Tree` and `TreeBuffer`\n/// objects. By packing detail information into `TreeBuffer` leaf\n/// nodes, the representation is made a lot more memory-efficient.\n///\n/// However, when you want to actually work with tree nodes, this\n/// representation is very awkward, so most client code will want to\n/// use the [`TreeCursor`](#common.TreeCursor) or\n/// [`SyntaxNode`](#common.SyntaxNode) interface instead, which provides\n/// a view on some part of this data structure, and can be used to\n/// move around to adjacent nodes.\nexport class Tree {\n /// @internal\n props: null | {[id: number]: any} = null\n\n /// Construct a new tree. See also [`Tree.build`](#common.Tree^build).\n constructor(\n /// The type of the top node.\n readonly type: NodeType,\n /// This node's child nodes.\n readonly children: readonly (Tree | TreeBuffer)[],\n /// The positions (offsets relative to the start of this tree) of\n /// the children.\n readonly positions: readonly number[],\n /// The total length of this tree\n readonly length: number,\n /// Per-node [node props](#common.NodeProp) to associate with this node.\n props?: readonly [NodeProp<any> | number, any][]\n ) {\n if (props && props.length) {\n this.props = Object.create(null)\n for (let [prop, value] of props) this.props![typeof prop == \"number\" ? prop : prop.id] = value\n }\n }\n\n /// @internal\n toString(): string {\n let mounted = this.prop(NodeProp.mounted)\n if (mounted && !mounted.overlay) return mounted.tree.toString()\n let children = \"\"\n for (let ch of this.children) {\n let str = ch.toString()\n if (str) {\n if (children) children += \",\"\n children += str\n }\n }\n return !this.type.name ? children :\n (/\\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) +\n (children.length ? \"(\" + children + \")\" : \"\")\n }\n\n /// The empty tree\n static empty = new Tree(NodeType.none, [], [], 0)\n\n /// Get a [tree cursor](#common.TreeCursor) rooted at this tree. When\n /// `pos` is given, the cursor is [moved](#common.TreeCursor.moveTo)\n /// to the given position and side.\n cursor(pos?: number, side: -1 | 0 | 1 = 0): TreeCursor {\n let scope = (pos != null && CachedNode.get(this)) || (this.topNode as TreeNode)\n let cursor = new TreeCursor(scope)\n if (pos != null) {\n cursor.moveTo(pos, side)\n CachedNode.set(this, cursor._tree)\n }\n return cursor\n }\n\n /// Get a [tree cursor](#common.TreeCursor) that, unlike regular\n /// cursors, doesn't skip through\n /// [anonymous](#common.NodeType.isAnonymous) nodes and doesn't\n /// automatically enter mounted nodes.\n fullCursor(): TreeCursor {\n return new TreeCursor(this.topNode as TreeNode, Mode.Full)\n }\n\n /// Get a [syntax node](#common.SyntaxNode) object for the top of the\n /// tree.\n get topNode(): SyntaxNode {\n return new TreeNode(this, 0, 0, null)\n }\n\n /// Get the [syntax node](#common.SyntaxNode) at the given position.\n /// If `side` is -1, this will move into nodes that end at the\n /// position. If 1, it'll move into nodes that start at the\n /// position. With 0, it'll only enter nodes that cover the position\n /// from both sides.\n resolve(pos: number, side: -1 | 0 | 1 = 0) {\n return this.cursor(pos, side).node\n }\n\n /// Like [`resolve`](#common.Tree.resolve), but will enter\n /// [overlaid](#common.MountedTree.overlay) nodes, producing a syntax node\n /// pointing into the innermost overlaid tree at the given position\n /// (with parent links going through all parent structure, including\n /// the host trees).\n resolveInner(pos: number, side: -1 | 0 | 1 = 0) {\n let result = this.topNode\n for (;;) {\n let inner = result.enter(pos, side)\n if (!inner) return result\n result = inner\n }\n }\n\n /// Iterate over the tree and its children, calling `enter` for any\n /// node that touches the `from`/`to` region (if given) before\n /// running over such a node's children, and `leave` (if given) when\n /// leaving the node. When `enter` returns `false`, that node will\n /// not have its children iterated over (or `leave` called).\n iterate(spec: {\n enter(type: NodeType, from: number, to: number, get: () => SyntaxNode): false | void,\n leave?(type: NodeType, from: number, to: number, get: () => SyntaxNode): void,\n from?: number,\n to?: number\n }) {\n let {enter, leave, from = 0, to = this.length} = spec\n for (let c = this.cursor(), get = () => c.node;;) {\n let mustLeave = false\n if (c.from <= to && c.to >= from && (c.type.isAnonymous || enter(c.type, c.from, c.to, get) !== false)) {\n if (c.firstChild()) continue\n if (!c.type.isAnonymous) mustLeave = true\n }\n for (;;) {\n if (mustLeave && leave) leave(c.type, c.from, c.to, get)\n mustLeave = c.type.isAnonymous\n if (c.nextSibling()) break\n if (!c.parent()) return\n mustLeave = true\n }\n }\n }\n\n /// Get the value of the given [node prop](#common.NodeProp) for this\n /// node. Works with both per-node and per-type props.\n prop<T>(prop: NodeProp<T>): T | undefined {\n return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : undefined\n }\n\n /// Returns the node's [per-node props](#common.NodeProp.perNode) in a\n /// format that can be passed to the [`Tree`](#common.Tree)\n /// constructor.\n get propValues(): readonly [NodeProp<any> | number, any][] {\n let result: [NodeProp<any> | number, any][] = []\n if (this.props) for (let id in this.props) result.push([+id, this.props[id]])\n return result\n }\n\n /// Balance the direct children of this tree, producing a copy of\n /// which may have children grouped into subtrees with type\n /// [`NodeType.none`](#common.NodeType^none).\n balance(config: {\n /// Function to create the newly balanced subtrees.\n makeTree?: (children: readonly (Tree | TreeBuffer)[], positions: readonly number[], length: number) => Tree\n } = {}) {\n return this.children.length <= Balance.BranchFactor ? this :\n balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length,\n (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues),\n config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)))\n }\n\n /// Build a tree from a postfix-ordered buffer of node information,\n /// or a cursor over such a buffer.\n static build(data: BuildData) { return buildTree(data) }\n}\n\ntype BuildData = {\n /// The buffer or buffer cursor to read the node data from.\n ///\n /// When this is an array, it should contain four values for every\n /// node in the tree.\n ///\n /// - The first holds the node's type, as a node ID pointing into\n /// the given `NodeSet`.\n /// - The second holds the node's start offset.\n /// - The third the end offset.\n /// - The fourth the amount of space taken up in the array by this\n /// node and its children. Since there's four values per node,\n /// this is the total number of nodes inside this node (children\n /// and transitive children) plus one for the node itself, times\n /// four.\n ///\n /// Parent nodes should appear _after_ child nodes in the array. As\n /// an example, a node of type 10 spanning positions 0 to 4, with\n /// two children, of type 11 and 12, might look like this:\n ///\n /// [11, 0, 1, 4, 12, 2, 4, 4, 10, 0, 4, 12]\n buffer: BufferCursor | readonly number[],\n /// The node types to use.\n nodeSet: NodeSet,\n /// The id of the top node type, if any.\n topID: number,\n /// The position the tree should start at. Defaults to 0.\n start?: number,\n /// The position in the buffer where the function should stop\n /// reading. Defaults to 0.\n bufferStart?: number,\n /// The length of the wrapping node. The end offset of the last\n /// child is used when not provided.\n length?: number,\n /// The maximum buffer length to use. Defaults to\n /// [`DefaultBufferLength`](#common.DefaultBufferLength).\n maxBufferLength?: number,\n /// An optional array holding reused nodes that the buffer can refer\n /// to.\n reused?: readonly Tree[],\n /// The first node type that indicates repeat constructs in this\n /// grammar.\n minRepeatType?: number\n}\n\n/// This is used by `Tree.build` as an abstraction for iterating over\n/// a tree buffer. A cursor initially points at the very last element\n/// in the buffer. Every time `next()` is called it moves on to the\n/// previous one.\nexport interface BufferCursor {\n /// The current buffer position (four times the number of nodes\n /// remaining).\n pos: number\n /// The node ID of the next node in the buffer.\n id: number\n /// The start position of the next node in the buffer.\n start: number\n /// The end position of the next node.\n end: number\n /// The size of the next node (the number of nodes inside, counting\n /// the node itself, times 4).\n size: number\n /// Moves `this.pos` down by 4.\n next(): void\n /// Create a copy of this cursor.\n fork(): BufferCursor\n}\n\nclass FlatBufferCursor implements BufferCursor {\n constructor(readonly buffer: readonly number[], public index: number) {}\n\n get id() { return this.buffer[this.index - 4] }\n get start() { return this.buffer[this.index - 3] }\n get end() { return this.buffer[this.index - 2] }\n get size() { return this.buffer[this.index - 1] }\n\n get pos() { return this.index }\n\n next() { this.index -= 4 }\n\n fork() { return new FlatBufferCursor(this.buffer, this.index) }\n}\n\n/// Tree buffers contain (type, start, end, endIndex) quads for each\n/// node. In such a buffer, nodes are stored in prefix order (parents\n/// before children, with the endIndex of the parent indicating which\n/// children belong to it)\nexport class TreeBuffer {\n /// Create a tree buffer.\n constructor(\n /// The buffer's content.\n readonly buffer: Uint16Array,\n /// The total length of the group of nodes in the buffer.\n readonly length: number,\n /// The node set used in this buffer.\n readonly set: NodeSet\n ) {}\n\n /// @internal\n get type() { return NodeType.none }\n\n /// @internal\n toString() {\n let result: string[] = []\n for (let index = 0; index < this.buffer.length;) {\n result.push(this.childString(index))\n index = this.buffer[index + 3]\n }\n return result.join(\",\")\n }\n\n /// @internal\n childString(index: number): string {\n let id = this.buffer[index], endIndex = this.buffer[index + 3]\n let type = this.set.types[id], result = type.name\n if (/\\W/.test(result) && !type.isError) result = JSON.stringify(result)\n index += 4\n if (endIndex == index) return result\n let children: string[] = []\n while (index < endIndex) {\n children.push(this.childString(index))\n index = this.buffer[index + 3]\n }\n return result + \"(\" + children.join(\",\") + \")\"\n }\n\n /// @internal\n findChild(startIndex: number, endIndex: number, dir: 1 | -1, pos: number, side: Side) {\n let {buffer} = this, pick = -1\n for (let i = startIndex; i != endIndex; i = buffer[i + 3]) {\n if (checkSide(side, pos, buffer[i + 1], buffer[i + 2])) {\n pick = i\n if (dir > 0) break\n }\n }\n return pick\n }\n\n /// @internal\n slice(startI: number, endI: number, from: number, to: number) {\n let b = this.buffer\n let copy = new Uint16Array(endI - startI)\n for (let i = startI, j = 0; i < endI;) {\n copy[j++] = b[i++]\n copy[j++] = b[i++] - from\n copy[j++] = b[i++] - from\n copy[j++] = b[i++] - startI\n }\n return new TreeBuffer(copy, to - from, this.set)\n }\n}\n\n/// A syntax node provides an immutable pointer to a given node in a\n/// tree. When iterating over large amounts of nodes, you may want to\n/// use a mutable [cursor](#common.TreeCursor) instead, which is more\n/// efficient.\nexport interface SyntaxNode {\n /// The type of the node.\n type: NodeType\n /// The name of the node (`.type.name`).\n name: string\n /// The start position of the node.\n from: number\n /// The end position of the node.\n to: number\n\n /// The node's parent node, if any.\n parent: SyntaxNode | null\n /// The first child, if the node has children.\n firstChild: SyntaxNode | null\n /// The node's last child, if available.\n lastChild: SyntaxNode | null\n /// The first child that ends after `pos`.\n childAfter(pos: number): SyntaxNode | null\n /// The last child that starts before `pos`.\n childBefore(pos: number): SyntaxNode | null\n /// Enter the child at the given position. If side is -1 the child\n /// may end at that position, when 1 it may start there.\n ///\n /// This will by default enter\n /// [overlaid](#common.MountedTree.overlay)\n /// [mounted](#common.NodeProp^mounted) trees. You can set\n /// `overlays` to false to disable that.\n ///\n /// Similarly, when `buffers` is false this will not enter\n /// [buffers](#common.TreeBuffer), only [nodes](#common.Tree) (which\n /// is mostly useful when looking for props, which cannot exist on\n /// buffer-allocated nodes).\n enter(pos: number, side: -1 | 0 | 1, overlays?: boolean, buffers?: boolean): SyntaxNode | null\n /// This node's next sibling, if any.\n nextSibling: SyntaxNode | null\n /// This node's previous sibling.\n prevSibling: SyntaxNode | null\n /// A [tree cursor](#common.TreeCursor) starting at this node.\n cursor: TreeCursor\n /// Find the node around, before (if `side` is -1), or after (`side`\n /// is 1) the given position. Will look in parent nodes if the\n /// position is outside this node.\n resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode\n /// Move the position to the innermost node before `pos` that looks\n /// like it is unfinished (meaning it ends in an error node or has a\n /// child ending in an error node right at its end).\n enterUnfinishedNodesBefore(pos: number): SyntaxNode\n /// Get the [tree](#common.Tree) that represents the current node, if\n /// any. Will return null when the node is in a [tree\n /// buffer](#common.TreeBuffer).\n tree: Tree | null\n /// Get a [tree](#common.Tree) for this node. Will allocate one if it\n /// points into a buffer.\n toTree(): Tree\n\n /// Get the first child of the given type (which may be a [node\n /// name](#common.NodeType.name) or a [group\n /// name](#common.NodeProp^group)). If `before` is non-null, only\n /// return children that occur somewhere after a node with that name\n /// or group. If `after` is non-null, only return children that\n /// occur somewhere before a node with that name or group.\n getChild(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode | null\n\n /// Like [`getChild`](#common.SyntaxNode.getChild), but return all\n /// matching children, not just the first.\n getChildren(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode[]\n}\n\nconst enum Side {\n Before = -2,\n AtOrBefore = -1,\n Around = 0,\n AtOrAfter = 1,\n After = 2,\n DontCare = 4\n}\n\nfunction checkSide(side: Side, pos: number, from: number, to: number) {\n switch (side) {\n case Side.Before: return from < pos\n case Side.AtOrBefore: return to >= pos && from < pos\n case Side.Around: return from < pos && to > pos\n case Side.AtOrAfter: return from <= pos && to > pos\n case Side.After: return to > pos\n case Side.DontCare: return true\n }\n}\n\nexport const enum Mode {\n Full = 1,\n NoEnterBuffer = 2,\n}\n\nfunction enterUnfinishedNodesBefore(node: SyntaxNode, pos: number) {\n let scan = node.childBefore(pos)\n while (scan) {\n let last = scan.lastChild\n if (!last || last.to != scan.to) break\n if (last.type.isError && last.from == last.to) {\n node = scan\n scan = last.prevSibling\n } else {\n scan = last\n }\n }\n return node\n}\n\nexport class TreeNode implements SyntaxNode {\n constructor(readonly node: Tree,\n readonly _from: number,\n // Index in parent node, set to -1 if the node is not a direct child of _parent.node (overlay)\n readonly index: number,\n readonly _parent: TreeNode | null) {}\n\n get type() { return this.node.type }\n\n get name() { return this.node.type.name }\n\n get from() { return this._from }\n\n get to() { return this._from + this.node.length }\n\n nextChild(i: number, dir: 1 | -1, pos: number, side: Side, mode: Mode = 0): TreeNode | BufferNode | null {\n for (let parent: TreeNode = this;;) {\n for (let {children, positions} = parent.node, e = dir > 0 ? children.length : -1; i != e; i += dir) {\n let next = children[i], start = positions[i] + parent._from\n if (!checkSide(side, pos, start, start + next.length)) continue\n if (next instanceof TreeBuffer) {\n if (mode & Mode.NoEnterBuffer) continue\n let index = next.findChild(0, next.buffer.length, dir, pos - start, side)\n if (index > -1) return new BufferNode(new BufferContext(parent, next, i, start), null, index)\n } else if ((mode & Mode.Full) || (!next.type.isAnonymous || hasChild(next))) {\n let mounted\n if (!(mode & Mode.Full) && next.props && (mounted = next.prop(NodeProp.mounted)) && !mounted.overlay)\n return new TreeNode(mounted.tree, start, i, parent)\n let inner = new TreeNode(next, start, i, parent)\n return (mode & Mode.Full) || !inner.type.isAnonymous ? inner\n : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side)\n }\n }\n if ((mode & Mode.Full) || !parent.type.isAnonymous) return null\n if (parent.index >= 0) i = parent.index + dir\n else i = dir < 0 ? -1 : parent._parent!.node.children.length\n parent = parent._parent!\n if (!parent) return null\n }\n }\n\n get firstChild() { return this.nextChild(0, 1, 0, Side.DontCare) }\n get lastChild() { return this.nextChild(this.node.children.length - 1, -1, 0, Side.DontCare) }\n\n childAfter(pos: number) { return this.nextChild(0, 1, pos, Side.After) }\n childBefore(pos: number) { return this.nextChild(this.node.children.length - 1, -1, pos, Side.Before) }\n\n enter(pos: number, side: -1 | 0 | 1, overlays = true, buffers = true) {\n let mounted\n if (overlays && (mounted = this.node.prop(NodeProp.mounted)) && mounted.overlay) {\n let rPos = pos - this.from\n for (let {from, to} of mounted.overlay) {\n if ((side > 0 ? from <= rPos : from < rPos) &&\n (side < 0 ? to >= rPos : to > rPos))\n return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this)\n }\n }\n return this.nextChild(0, 1, pos, side, buffers ? 0 : Mode.NoEnterBuffer)\n }\n\n nextSignificantParent() {\n let val: TreeNode = this\n while (val.type.isAnonymous && val._parent) val = val._parent\n return val\n }\n\n get parent() {\n return this._parent ? this._parent.nextSignificantParent() : null\n }\n\n get nextSibling() {\n return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, Side.DontCare) : null\n }\n get prevSibling() {\n return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, Side.DontCare) : null\n }\n\n get cursor() { return new TreeCursor(this) }\n\n get tree() { return this.node }\n\n toTree() { return this.node }\n\n resolve(pos: number, side: -1 | 0 | 1 = 0) {\n return this.cursor.moveTo(pos, side).node\n }\n\n enterUnfinishedNodesBefore(pos: number) { return enterUnfinishedNodesBefore(this, pos) }\n\n getChild(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n let r = getChildren(this, type, before, after)\n return r.length ? r[0] : null\n }\n\n getChildren(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n return getChildren(this, type, before, after)\n }\n\n /// @internal\n toString() { return this.node.toString() }\n}\n\nfunction getChildren(node: SyntaxNode, type: string | number, before: string | number | null, after: string | number | null): SyntaxNode[] {\n let cur = node.cursor, result: SyntaxNode[] = []\n if (!cur.firstChild()) return result\n if (before != null) while (!cur.type.is(before)) if (!cur.nextSibling()) return result\n for (;;) {\n if (after != null && cur.type.is(after)) return result\n if (cur.type.is(type)) result.push(cur.node)\n if (!cur.nextSibling()) return after == null ? result : []\n }\n}\n\nclass BufferContext {\n constructor(readonly parent: TreeNode,\n readonly buffer: TreeBuffer,\n readonly index: number,\n readonly start: number) {}\n}\n\nclass BufferNode implements SyntaxNode {\n type: NodeType\n\n get name() { return this.type.name }\n\n get from() { return this.context.start + this.context.buffer.buffer[this.index + 1] }\n\n get to() { return this.context.start + this.context.buffer.buffer[this.index + 2] }\n\n constructor(readonly context: BufferContext,\n readonly _parent: BufferNode | null,\n readonly index: number) {\n this.type = context.buffer.set.types[context.buffer.buffer[index]]\n }\n\n child(dir: 1 | -1, pos: number, side: Side): BufferNode | null {\n let {buffer} = this.context\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side)\n return index < 0 ? null : new BufferNode(this.context, this, index)\n }\n\n get firstChild() { return this.child(1, 0, Side.DontCare) }\n get lastChild() { return this.child(-1, 0, Side.DontCare) }\n\n childAfter(pos: number) { return this.child(1, pos, Side.After) }\n childBefore(pos: number) { return this.child(-1, pos, Side.Before) }\n\n enter(pos: number, side: -1 | 0 | 1, overlays?: boolean, buffers = true) {\n if (!buffers) return null\n let {buffer} = this.context\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side)\n return index < 0 ? null : new BufferNode(this.context, this, index)\n }\n\n get parent() {\n return this._parent || this.context.parent.nextSignificantParent()\n }\n\n externalSibling(dir: 1 | -1) {\n return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, Side.DontCare)\n }\n\n get nextSibling(): SyntaxNode | null {\n let {buffer} = this.context\n let after = buffer.buffer[this.index + 3]\n if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))\n return new BufferNode(this.context, this._parent, after)\n return this.externalSibling(1)\n }\n\n get prevSibling(): SyntaxNode | null {\n let {buffer} = this.context\n let parentStart = this._parent ? this._parent.index + 4 : 0\n if (this.index == parentStart) return this.externalSibling(-1)\n return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, Side.DontCare))\n }\n\n get cursor() { return new TreeCursor(this) }\n\n get tree() { return null }\n\n toTree() {\n let children = [], positions = []\n let {buffer} = this.context\n let startI = this.index + 4, endI = buffer.buffer[this.index + 3]\n if (endI > startI) {\n let from = buffer.buffer[this.index + 1], to = buffer.buffer[this.index + 2]\n children.push(buffer.slice(startI, endI, from, to))\n positions.push(0)\n }\n return new Tree(this.type, children, positions, this.to - this.from)\n }\n\n resolve(pos: number, side: -1 | 0 | 1 = 0) {\n return this.cursor.moveTo(pos, side).node\n }\n\n enterUnfinishedNodesBefore(pos: number) { return enterUnfinishedNodesBefore(this, pos) }\n\n /// @internal\n toString() { return this.context.buffer.childString(this.index) }\n\n getChild(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n let r = getChildren(this, type, before, after)\n return r.length ? r[0] : null\n }\n\n getChildren(type: string | number, before: string | number | null = null, after: string | number | null = null) {\n return getChildren(this, type, before, after)\n }\n}\n\n/// A tree cursor object focuses on a given node in a syntax tree, and\n/// allows you to move to adjacent nodes.\nexport class TreeCursor {\n /// The node's type.\n type!: NodeType\n\n /// Shorthand for `.type.name`.\n get name() { return this.type.name }\n\n /// The start source offset of this node.\n from!: number\n\n /// The end source offset.\n to!: number\n\n /// @internal\n _tree!: TreeNode\n private buffer: BufferContext | null = null\n private stack: number[] = []\n private index: number = 0\n private bufferNode: BufferNode | null = null\n\n /// @internal\n constructor(\n node: TreeNode | BufferNode,\n /// @internal\n readonly mode = 0\n ) {\n if (node instanceof TreeNode) {\n this.yieldNode(node)\n } else {\n this._tree = node.context.parent\n this.buffer = node.context\n for (let n: BufferNode | null = node._parent; n; n = n._parent) this.stack.unshift(n.index)\n this.bufferNode = node\n this.yieldBuf(node.index)\n }\n }\n\n private yieldNode(node: TreeNode | null) {\n if (!node) return false\n this._tree = node\n this.type = node.type\n this.from = node.from\n this.to = node.to\n return true\n }\n\n private yieldBuf(index: number, type?: NodeType) {\n this.index = index\n let {start, buffer} = this.buffer!\n this.type = type || buffer.set.types[buffer.buffer[index]]\n this.from = start + buffer.buffer[index + 1]\n this.to = start + buffer.buffer[index + 2]\n return true\n }\n\n private yield(node: TreeNode | BufferNode | null) {\n if (!node) return false\n if (node instanceof TreeNode) {\n this.buffer = null\n return this.yieldNode(node)\n }\n this.buffer = node.context\n return this.yieldBuf(node.index, node.type)\n }\n\n /// @internal\n toString() {\n return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString()\n }\n\n /// @internal\n enterChild(dir: 1 | -1, pos: number, side: Side) {\n if (!this.buffer)\n return this.yield(this._tree.nextChild(dir < 0 ? this._tree.node.children.length - 1 : 0, dir, pos, side, this.mode))\n\n let {buffer} = this.buffer\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side)\n if (index < 0) return false\n this.stack.push(this.index)\n return this.yieldBuf(index)\n }\n\n /// Move the cursor to this node's first child. When this returns\n /// false, the node has no child, and the cursor has not been moved.\n firstChild() { return this.enterChild(1, 0, Side.DontCare) }\n\n /// Move the cursor to this node's last child.\n lastChild() { return this.enterChild(-1, 0, Side.DontCare) }\n\n /// Move the cursor to the first child that ends after `pos`.\n childAfter(pos: number) { return this.enterChild(1, pos, Side.After) }\n\n /// Move to the last child that starts before `pos`.\n childBefore(pos: number) { return this.enterChild(-1, pos, Side.Before) }\n\n /// Move the cursor to the child around `pos`. If side is -1 the\n /// child may end at that position, when 1 it may start there. This\n /// will also enter [overlaid](#common.MountedTree.overlay)\n /// [mounted](#common.NodeProp^mounted) trees unless `overlays` is\n /// set to false.\n enter(pos: number, side: -1 | 0 | 1, overlays = true, buffers = true) {\n if (!this.buffer) return this.yield(this._tree.enter(pos, side, overlays && !(this.mode & Mode.Full), buffers))\n return buffers ? this.enterChild(1, pos, side) : false\n }\n\n /// Move to the node's parent node, if this isn't the top node.\n parent() {\n if (!this.buffer) return this.yieldNode((this.mode & Mode.Full) ? this._tree._parent : this._tree.parent)\n if (this.stack.length) return this.yieldBuf(this.stack.pop()!)\n let parent = (this.mode & Mode.Full) ? this.buffer.parent : this.buffer.parent.nextSignificantParent()\n this.buffer = null\n return this.yieldNode(parent)\n }\n\n /// @internal\n sibling(dir: 1 | -1) {\n if (!this.buffer)\n return !this._tree._parent ? false\n : this.yield(this._tree.index < 0 ? null\n : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, Side.DontCare, this.mode))\n\n let {buffer} = this.buffer, d = this.stack.length - 1\n if (dir < 0) {\n let parentStart = d < 0 ? 0 : this.stack[d] + 4\n if (this.index != parentStart)\n return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, Side.DontCare))\n } else {\n let after = buffer.buffer[this.index + 3]\n if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))\n return this.yieldBuf(after)\n }\n return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, Side.DontCare, this.mode)) : false\n }\n\n /// Move to this node's next sibling, if any.\n nextSibling() { return this.sibling(1) }\n\n /// Move to this node's previous sibling, if any.\n prevSibling() { return this.sibling(-1) }\n\n private atLastNode(dir: 1 | -1) {\n let index, parent: TreeNode | null, {buffer} = this\n if (buffer) {\n if (dir > 0) {\n if (this.index < buffer.buffer.buffer.length) return false\n } else {\n for (let i = 0; i < this.index; i++) if (buffer.buffer.buffer[i + 3] < this.index) return false\n }\n ;({index, parent} = buffer)\n } else {\n ({index, _parent: parent} = this._tree)\n }\n for (; parent; {index, _parent: parent} = parent) {\n if (index > -1) for (let i = index + dir, e = dir < 0 ? -1 : parent.node.children.length; i != e; i += dir) {\n let child = parent.node.children[i]\n if ((this.mode & Mode.Full) || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child)) return false\n }\n }\n return true\n }\n\n private move(dir: 1 | -1, enter: boolean) {\n if (enter && this.enterChild(dir, 0, Side.DontCare)) return true\n for (;;) {\n if (this.sibling(dir)) return true\n if (this.atLastNode(dir) || !this.parent()) return false\n }\n }\n\n /// Move to the next node in a\n /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR))\n /// traversal, going from a node to its first child or, if the\n /// current node is empty or `enter` is false, its next sibling or\n /// the next sibling of the first parent node that has one.\n next(enter = true) { return this.move(1, enter) }\n\n /// Move to the next node in a last-to-first pre-order traveral. A\n /// node is followed by its last child or, if it has none, its\n /// previous sibling or the previous sibling of the first parent\n /// node that has one.\n prev(enter = true) { return this.move(-1, enter) }\n\n /// Move the cursor to the innermost node that covers `pos`. If\n /// `side` is -1, it will enter nodes that end at `pos`. If it is 1,\n /// it will enter nodes that start at `pos`.\n moveTo(pos: number, side: -1 | 0 | 1 = 0) {\n // Move up to a node that actually holds the position, if possible\n while (this.from == this.to ||\n (side < 1 ? this.from >= pos : this.from > pos) ||\n (side > -1 ? this.to <= pos : this.to < pos))\n if (!this.parent()) break\n\n // Then scan down into child nodes as far as possible\n while (this.enterChild(1, pos, side)) {}\n return this\n }\n\n /// Get a [syntax node](#common.SyntaxNode) at the cursor's current\n /// position.\n get node(): SyntaxNode {\n if (!this.buffer) return this._tree\n \n let cache = this.bufferNode, result: BufferNode | null = null, depth = 0\n if (cache && cache.context == this.buffer) {\n scan: for (let index = this.index, d = this.stack.length; d >= 0;) {\n for (let c: BufferNode | null = cache; c; c = c._parent) if (c.index == index) {\n if (index == this.index) return c\n result = c\n depth = d + 1\n break scan\n }\n index = this.stack[--d]\n }\n }\n for (let i = depth; i < this.stack.length; i++) result = new BufferNode(this.buffer, result, this.stack[i])\n return this.bufferNode = new BufferNode(this.buffer, result, this.index)\n }\n\n /// Get the [tree](#common.Tree) that represents the current node, if\n /// any. Will return null when the node is in a [tree\n /// buffer](#common.TreeBuffer).\n get tree(): Tree | null {\n return this.buffer ? null : this._tree.node\n }\n}\n\nfunction hasChild(tree: Tree): boolean {\n return tree.children.some(ch => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch))\n}\n\nconst enum Balance { BranchFactor = 8 }\n\nconst enum SpecialRecord {\n Reuse = -1,\n ContextChange = -3,\n LookAhead = -4\n}\n\nfunction buildTree(data: BuildData) {\n let {buffer, nodeSet,\n maxBufferLength = DefaultBufferLength,\n reused = [],\n minRepeatType = nodeSet.types.length} = data\n let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer as BufferCursor\n let types = nodeSet.types\n\n let contextHash = 0, lookAhead = 0\n\n function takeNode(parentStart: number, minPos: number,\n children: (Tree | TreeBuffer)[], positions: number[],\n inRepeat: number) {\n let {id, start, end, size} = cursor\n let lookAheadAtStart = lookAhead\n while (size < 0) {\n cursor.next()\n if (size == SpecialRecord.Reuse) {\n let node = reused[id]\n children.push(node)\n positions.push(start - parentStart)\n return\n } else if (size == SpecialRecord.ContextChange) { // Context change\n contextHash = id\n return\n } else if (size == SpecialRecord.LookAhead) {\n lookAhead = id\n return\n } else {\n throw new RangeError(`Unrecognized record size: ${size}`)\n }\n ;({id, start, end, size} = cursor)\n }\n\n let type = types[id], node, buffer: {size: number, start: number, skip: number} | undefined\n let startPos = start - parentStart\n if (end - start <= maxBufferLength && (buffer = findBufferSize(cursor.pos - minPos, inRepeat))) {\n // Small enough for a buffer, and no reused nodes inside\n let data = new Uint16Array(buffer.size - buffer.skip)\n let endPos = cursor.pos - buffer.size, index = data.length\n while (cursor.pos > endPos)\n index = copyToBuffer(buffer.start, data, index)\n node = new TreeBuffer(data, end - buffer.start, nodeSet)\n startPos = buffer.start - parentStart\n } else { // Make it a node\n let endPos = cursor.pos - size\n cursor.next()\n let localChildren: (Tree | TreeBuffer)[] = [], localPositions: number[] = []\n let localInRepeat = id >= minRepeatType ? id : -1\n let lastGroup = 0, lastEnd = end\n while (cursor.pos > endPos) {\n if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {\n if (cursor.end <= lastEnd - maxBufferLength) {\n makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart)\n lastGroup = localChildren.length\n lastEnd = cursor.end\n }\n cursor.next()\n } else {\n takeNode(start, endPos, localChildren, localPositions, localInRepeat)\n }\n }\n if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)\n makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart)\n localChildren.reverse(); localPositions.reverse()\n\n if (localInRepeat > -1 && lastGroup > 0) {\n let make = makeBalanced(type)\n node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make)\n } else {\n node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end)\n }\n }\n\n children.push(node)\n positions.push(startPos)\n }\n\n function makeBalanced(type: NodeType) {\n return (children: readonly (Tree | TreeBuffer)[], positions: readonly number[], length: number) => {\n let lookAhead = 0, lastI = children.length - 1, last, lookAheadProp\n if (lastI >= 0 && (last = children[lastI]) instanceof Tree) {\n if (!lastI && last.type == type && last.length == length) return last\n if (lookAheadProp = last.prop(NodeProp.lookAhead))\n lookAhead = positions[lastI] + last.length + lookAheadProp\n }\n return makeTree(type, children, positions, length, lookAhead)\n }\n }\n\n function makeRepeatLeaf(children: (Tree | TreeBuffer)[], positions: number[], base: number, i: number,\n from: number, to: number, type: number, lookAhead: number) {\n let localChildren = [], localPositions = []\n while (children.length > i) { localChildren.push(children.pop()!); localPositions.push(positions.pop()! + base - from) }\n children.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead - to))\n positions.push(from - base)\n }\n\n function makeTree(type: NodeType,\n children: readonly (Tree | TreeBuffer)[],\n positions: readonly number[], length: number,\n lookAhead: number = 0,\n props?: readonly [number | NodeProp<any>, any][]) {\n if (contextHash) {\n let pair: [number | NodeProp<any>, any] = [NodeProp.contextHash, contextHash]\n props = props ? [pair].concat(props) : [pair]\n }\n if (lookAhead > 25) {\n let pair: [number | NodeProp<any>, any] = [NodeProp.lookAhead, lookAhead]\n props = props ? [pair].concat(props) : [pair]\n }\n return new Tree(type, children, positions, length, props)\n }\n\n function findBufferSize(maxSize: number, inRepeat: number) {\n // Scan through the buffer to find previous siblings that fit\n // together in a TreeBuffer, and don't contain any reused nodes\n // (which can't be stored in a buffer).\n // If `inRepeat` is > -1, ignore node boundaries of that type for\n // nesting, but make sure the end falls either at the start\n // (`maxSize`) or before such a node.\n let fork = cursor.fork()\n let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength\n let result = {size: 0, start: 0, skip: 0}\n scan: for (let minPos = fork.pos - maxSize; fork.pos > minPos;) {\n let nodeSize = fork.size\n // Pretend nested repeat nodes of the same type don't exist\n if (fork.id == inRepeat && nodeSize >= 0) {\n // Except that we store the current state as a valid return\n // value.\n result.size = size; result.start = start; result.skip = skip\n skip += 4; size += 4\n fork.next()\n continue\n }\n let startPos = fork.pos - nodeSize\n if (nodeSize < 0 || startPos < minPos || fork.start < minStart) break\n let localSkipped = fork.id >= minRepeatType ? 4 : 0\n let nodeStart = fork.start\n fork.next()\n while (fork.pos > startPos) {\n if (fork.size < 0) {\n if (fork.size == SpecialRecord.ContextChange) localSkipped += 4\n else break scan\n } else if (fork.id >= minRepeatType) {\n localSkipped += 4\n }\n fork.next()\n }\n start = nodeStart\n size += nodeSize\n skip += localSkipped\n }\n if (inRepeat < 0 || size == maxSize) {\n result.size = size; result.start = start; result.skip = skip\n }\n return result.size > 4 ? result : undefined\n }\n\n function copyToBuffer(bufferStart: number, buffer: Uint16Array, index: number): number {\n let {id, start, end, size} = cursor\n cursor.next()\n if (size >= 0 && id < minRepeatType) {\n let startIndex = index\n if (size > 4) {\n let endPos = cursor.pos - (size - 4)\n while (cursor.pos > endPos)\n index = copyToBuffer(bufferStart, buffer, index)\n }\n buffer[--index] = startIndex\n buffer[--index] = end - bufferStart\n buffer[--index] = start - bufferStart\n buffer[--index] = id\n } else if (size == SpecialRecord.ContextChange) {\n contextHash = id\n } else if (size == SpecialRecord.LookAhead) {\n lookAhead = id\n }\n return index\n }\n\n let children: (Tree | TreeBuffer)[] = [], positions: number[] = []\n while (cursor.pos > 0) takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1)\n let length = data.length ?? (children.length ? positions[0] + children[0].length : 0)\n return new Tree(types[data.topID], children.reverse(), positions.reverse(), length)\n}\n\nconst nodeSizeCache: WeakMap<Tree, number> = new WeakMap\nfunction nodeSize(balanceType: NodeType, node: Tree | TreeBuffer): number {\n if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType) return 1\n let size = nodeSizeCache.get(node)\n if (size == null) {\n size = 1\n for (let child of node.children) {\n if (child.type != balanceType || !(child instanceof Tree)) {\n size = 1\n break\n }\n size += nodeSize(balanceType, child)\n }\n nodeSizeCache.set(node, size)\n }\n return size\n}\n\nfunction balanceRange(\n // The type the balanced tree's inner nodes.\n balanceType: NodeType,\n // The direct children and their positions\n children: readonly (Tree | TreeBuffer)[],\n positions: readonly number[],\n // The index range in children/positions to use\n from: number, to: number,\n // The start position of the nodes, relative to their parent.\n start: number,\n // Length of the outer node\n length: number,\n // Function to build the top node of the balanced tree\n mkTop: ((children: readonly (Tree | TreeBuffer)[], positions: readonly number[], length: number) => Tree) | null,\n // Function to build internal nodes for the balanced tree\n mkTree: (children: readonly (Tree | TreeBuffer)[], positions: readonly number[], length: number) => Tree\n): Tree {\n let total = 0\n for (let i = from; i < to; i++) total += nodeSize(balanceType, children[i])\n\n let maxChild = Math.ceil((total * 1.5) / Balance.BranchFactor)\n let localChildren: (Tree | TreeBuffer)[] = [], localPositions: number[] = []\n function divide(children: readonly (Tree | TreeBuffer)[], positions: readonly number[],\n from: number, to: number, offset: number) {\n for (let i = from; i < to;) {\n let groupFrom = i, groupStart = positions[i], groupSize = nodeSize(balanceType, children[i])\n i++\n for (; i < to; i++) {\n let nextSize = nodeSize(balanceType, children[i])\n if (groupSize + nextSize >= maxChild) break\n groupSize += nextSize\n }\n if (i == groupFrom + 1) {\n if (groupSize > maxChild) {\n let only = children[groupFrom] as Tree // Only trees can have a size > 1\n divide(only.children, only.positions, 0, only.children.length, positions[groupFrom] + offset)\n continue\n }\n localChildren.push(children[groupFrom])\n } else {\n let length = positions[i - 1] + children[i - 1].length - groupStart\n localChildren.push(balanceRange(balanceType, children, positions, groupFrom, i, groupStart, length, null, mkTree))\n }\n localPositions.push(groupStart + offset - start)\n }\n }\n divide(children, positions, from, to, 0)\n return (mkTop || mkTree)(localChildren, localPositions, length)\n}\n"],"names":[],"mappings":"AAEA;AACA;AAEA;MACa,mBAAmB,GAAG,KAAI;AAEvC,IAAI,UAAU,GAAG,CAAC,CAAA;MAEL,KAAK;IAChB,YAAqB,IAAY,EAAW,EAAU;QAAjC,SAAI,GAAJ,IAAI,CAAQ;QAAW,OAAE,GAAF,EAAE,CAAQ;KAAI;CAC3D;AAED;AACA;AACA;MACa,QAAQ;;IAcnB,YAAY,SAUR,EAAE;QACJ,IAAI,CAAC,EAAE,GAAG,UAAU,EAAE,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAA;QAC/B,IA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