Skip to content

Commit 358cf95

Browse files
AndrewDantpre-commit-ci[bot]pokey
authored
Update parse-tree-patterns.md (#665)
* Update parse-tree-patterns.md * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update docs/contributing/parse-tree-patterns.md * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Pokey Rule <[email protected]>
1 parent ca0c11f commit 358cf95

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs/contributing/parse-tree-patterns.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ We have a small domain-specific language that we use to define patterns to look
66

77
`GRAND_PARENT_TYPE.*.CHILD_TYPE[FIELD]!?`
88

9-
| Syntax | Description |
10-
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
11-
| TYPE | Match node type<br/>`node.type` |
12-
| Dot operator(`.`) | Type hierarchy between parent and child |
13-
| Wildcard op(`*`) | Match any type |
14-
| Negation op(`~`) | Match any type other than what is specified after `~` |
15-
| Important op(`!`) | Use this node as result instead of parent.<br/>By default the leftmost/top node is used |
16-
| Optional op(`?`) | Node is optional. Will match if available. |
17-
| Field op(`[field]`) | Get child field node for resulting node.<br/>Only evaluated on the resulting node at the end.<br/>`node.childForFieldName(field)` |
9+
| Syntax | Description |
10+
| ------------------- | --------------------------------------------------------------------------------------- |
11+
| TYPE | Match node type<br/>`node.type` |
12+
| Dot operator(`.`) | Type hierarchy between parent and child |
13+
| Wildcard op(`*`) | Match any type |
14+
| Negation op(`~`) | Match any type other than what is specified after `~` |
15+
| Important op(`!`) | Use this node as result instead of parent.<br/>By default the leftmost/top node is used |
16+
| Optional op(`?`) | Node is optional. Will match if available. |
17+
| Field op(`[field]`) | Return child node at given field.<br/>`node.childForFieldName(field)` |
18+
| Index op(`[n]`) | Return nth named child node. |
1819

1920
## Multiple patterns
2021

0 commit comments

Comments
 (0)