Add draft grammar for KQL 1.0.0

This commit is contained in:
Lars Willighagen 2022-09-27 15:51:12 +02:00
parent d437cf228b
commit 728b3e0a1d
1 changed files with 18 additions and 0 deletions

View File

@ -101,3 +101,21 @@ Then the following queries are valid:
* `dependencies > []`
* -> fetches all direct-child nodes of any `dependencies` nodes in the
document. In this case, it will fetch both `miette` and `winapi` nodes.
## Full Grammar
Note: for rules that are not defined in this grammar, see [the KDL grammar](https://github.com/kdl-org/kdl/blob/main/SPEC.md#full-grammar).
```
query := selector q-ws* "||" q-ws* query | selector
selector := filter q-ws* selector-operator q-ws* selector | filter
selector-operator := ">" | "+" | "~" | ""
filter := matcher+
matcher := "top()"| "()" | identifier | type | accessor-matcher
accessor-matcher := "[" (comparison | accessor)? "]"
comparison := accessor q-ws* matcher-operator q-ws* (type | string | number | keyword)
accessor := "val(" number ")" | "prop(" identifier ")" | "name()" | "tag()" | "values()" | "props()" | identifier
matcher-operator := "=" | "!=" | ">" | "<" | ">=" | "<=" | "^=" | "$=" | "*="
q-ws := bom | unicode-space
```