lezer-tree
Advanced tools
Changelog
0.13.1 (2021-02-11)
Fix a bug where building a tree from a buffer would go wrong for repeat nodes whose children were all repeat nodes of the same type.
Changelog
0.13.0 (2020-12-04)
NodeType.isRepeated
is now called isAnonymous
, which more accurately describes what it means.
NodeGroup
has been renamed to NodeSet
to avoid confusion with NodeProp.group
.
The applyChanges
method on trees is no longer supported (TreeFragment
is now used to track reusable content).
Trees no longer have cut
and append
methods.
It is now possible to pass a node ID to SyntaxNode.getChild
/getChildren
and NodeType.is
. Allow specifying a tree length in Tree.build
Tree.build
now allows you to specify the length of the resulting tree.
Tree.fullCursor()
can now be used to get a cursor that includes anonymous nodes, rather than skipping them.
Introduces NodeType.define
to define node types.
The new TreeFragment
type is used to manage reusable subtrees for incremental parsing.
Tree.build
now accepts a start
option indicating the start offset of the tree.
The Input
type, which used to be InputStream
in the lezer package, is now exported from this package.
This package now exports a PartialParse
interface, which describes the interface used, for example, as return type from Parser.startParse
.
Changelog
0.12.2 (2020-10-28)
Fix a bug that made SyntaxNode.prevSibling
fail in most cases when the node is part of a buffer.
Changelog
0.12.1 (2020-10-26)
Fix issue where using Tree.append
with an empty tree as argument would return a tree with a nonsensical length
property.
Changelog
0.12.0 (2020-10-23)
Tree.iterate
no longer allows returning from inside the iteration (use cursors directly for that kind of use cases).
Subtree
has been renamed to SyntaxNode
and narrowed in scope a little.
The top
, skipped
, and error
node props no longer exist.
The package now offers a TreeCursor
abstraction, which can be used for both regular iteration and for custom traversal of a tree.
SyntaxNode
instances have nextSibling
/prevSibling
getters that allow more direct navigation through the tree.
Node types now expose isTop
, isSkipped
, isError
, and isRepeated
properties that indicate special status.
Adds NodeProp.group
to assign group names to node types.
Syntax nodes now have helper functions getChild
and getChildren
to retrieve direct child nodes by type or group.
NodeType.match
(and thus NodeProp.add
) now allows types to be targeted by group name.
Node types have a new is
method for checking whether their name or one of their groups matches a given string.