mirror of
https://github.com/cursorless-dev/cursorless.git
synced 2024-10-04 21:07:21 +03:00
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 <755842+pokey@users.noreply.github.com>
This commit is contained in:
parent
ca0c11f421
commit
358cf953cd
@ -6,15 +6,16 @@ We have a small domain-specific language that we use to define patterns to look
|
||||
|
||||
`GRAND_PARENT_TYPE.*.CHILD_TYPE[FIELD]!?`
|
||||
|
||||
| Syntax | Description |
|
||||
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TYPE | Match node type<br/>`node.type` |
|
||||
| Dot operator(`.`) | Type hierarchy between parent and child |
|
||||
| Wildcard op(`*`) | Match any type |
|
||||
| Negation op(`~`) | Match any type other than what is specified after `~` |
|
||||
| Important op(`!`) | Use this node as result instead of parent.<br/>By default the leftmost/top node is used |
|
||||
| Optional op(`?`) | Node is optional. Will match if available. |
|
||||
| Field op(`[field]`) | Get child field node for resulting node.<br/>Only evaluated on the resulting node at the end.<br/>`node.childForFieldName(field)` |
|
||||
| Syntax | Description |
|
||||
| ------------------- | --------------------------------------------------------------------------------------- |
|
||||
| TYPE | Match node type<br/>`node.type` |
|
||||
| Dot operator(`.`) | Type hierarchy between parent and child |
|
||||
| Wildcard op(`*`) | Match any type |
|
||||
| Negation op(`~`) | Match any type other than what is specified after `~` |
|
||||
| Important op(`!`) | Use this node as result instead of parent.<br/>By default the leftmost/top node is used |
|
||||
| Optional op(`?`) | Node is optional. Will match if available. |
|
||||
| Field op(`[field]`) | Return child node at given field.<br/>`node.childForFieldName(field)` |
|
||||
| Index op(`[n]`) | Return nth named child node. |
|
||||
|
||||
## Multiple patterns
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user