Home > @rushstack/tree-pattern > TreePattern
TreePattern class
A fast, lightweight pattern matcher for tree structures such as an Abstract Syntax Tree (AST).
Signature:
export declare class TreePattern
Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(pattern) | Constructs a new instance of the TreePattern class |
Methods
| 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. |