mirror of https://github.com/kdl-org/kdl.git
Add draft grammar for KQL 1.0.0 (#303)
* Add draft grammar for KQL 1.0.0 * Change whitespace in KQL grammar * Update KQL grammar to use new operators
This commit is contained in:
parent
d437cf228b
commit
06d1d67359
|
|
@ -101,3 +101,21 @@ Then the following queries are valid:
|
||||||
* `dependencies > []`
|
* `dependencies > []`
|
||||||
* -> fetches all direct-child nodes of any `dependencies` nodes in the
|
* -> fetches all direct-child nodes of any `dependencies` nodes in the
|
||||||
document. In this case, it will fetch both `miette` and `winapi` nodes.
|
document. In this case, it will fetch both `miette` and `winapi` nodes.
|
||||||
|
|
||||||
|
## Full Grammar
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue