mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -04:00
Add docs section about hidden rules
This commit is contained in:
parent
60eacbc7ff
commit
daf2c01d8b
|
|
@ -327,6 +327,10 @@ binary_expression: $ => choice(
|
|||
),
|
||||
```
|
||||
|
||||
### Hiding rules
|
||||
|
||||
You may have noticed in the above examples that some of the grammar rule name like `_expression` and `_type` began with an underscore. Starting a rule's name with an underscore causes the rule to be *hidden* in the syntax tree. This is useful for rules like `_expression` in the grammars above, which always just wrap a single child node. If these nodes were not hidden, they would add substantial depth and noise to the syntax tree without making it any easier to understand.
|
||||
|
||||
## Dealing with LR conflicts
|
||||
|
||||
[cst]: https://en.wikipedia.org/wiki/Parse_tree
|
||||
|
|
|
|||
Loading…
Reference in a new issue