kql: add some explanation for top() matcher

This commit is contained in:
Romain Delamare 2024-04-16 18:47:09 +02:00
parent b08fc4382a
commit 6c4c27e8c0
No known key found for this signature in database
GPG Key ID: A745121A23AF846B
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ properties, node names, etc). With the exception of `top()` and `()`, they are a
used inside a `[]` selector. Some matchers are unary, but most of them involve
binary operators.
The `top()` matcher can only be used as the first matcher of a selector. This means
that it cannot be the right operand of the `>`, `>>`, `+`, or `++` operators. As `||`
combines selectors, the `top()` can appear just after it. For instance,
`a > b || top() > b` is valid, but `a > top()` is not.
* `top()`: Returns all toplevel children of the current document.
* `top() > []`: Equivalent to `top()` on its own.
* `(foo)`: Selects any element whose type annotation is `foo`.