Home > @rushstack/tree-pattern > TreePattern

TreePattern class

A fast, lightweight pattern matcher for tree structures such as an Abstract Syntax Tree (AST).


export declare class TreePattern 


Constructor Modifiers Description
(constructor)(pattern)   Constructs a new instance of the TreePattern class


Method Modifiers Description
match(root, captures)   Match an input tree.
oneOf(possibleSubtrees) static Used to specify alternative possible subtrees in the search pattern.
tag(tagName, subtree) static Labels a subtree within the search pattern, so that the matching object can be retrieved.