mirror of https://github.com/kdl-org/kdl.git
iterate a bit on KQL
This commit is contained in:
parent
abae1f9a39
commit
7ab86588c0
|
|
@ -74,4 +74,7 @@
|
||||||
spaces for that purpose.
|
spaces for that purpose.
|
||||||
* The "any sibling" selector is now `++` instead of `~`, for consistency with
|
* The "any sibling" selector is now `++` instead of `~`, for consistency with
|
||||||
the new descendant selector.
|
the new descendant selector.
|
||||||
|
* Some parsing logic around the grammar has changed.
|
||||||
|
* Multi- and single-line comments are now supported, as well as line
|
||||||
|
continuations with `\`.
|
||||||
* Map operators have been removed entirely.
|
* Map operators have been removed entirely.
|
||||||
|
|
|
||||||
|
|
@ -104,18 +104,22 @@ Then the following queries are valid:
|
||||||
|
|
||||||
## Full Grammar
|
## 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).
|
Rules that are not defined in this grammar are prefixed with `$`, see [the KDL
|
||||||
|
grammar](https://github.com/kdl-org/kdl/blob/main/SPEC.md#full-grammar) for
|
||||||
|
what they expand to.
|
||||||
|
|
||||||
```
|
```
|
||||||
query-str := bom? query
|
query-str := $bom? query
|
||||||
query := selector q-ws* "||" q-ws* query | selector
|
query := selector q-ws* "||" q-ws* query | selector
|
||||||
selector := filter q-ws* selector-operator q-ws* selector | filter
|
selector := filter q-ws* selector-operator q-ws* selector | filter
|
||||||
selector-operator := ">>" | ">" | "++" | "+"
|
selector-operator := ">>" | ">" | "++" | "+"
|
||||||
filter := ( "top(" q-ws* ")" | "(" q-ws* ")" | type ) string? accessor-matcher*
|
filter := "top(" q-ws* ")" | matchers
|
||||||
|
matchers := type-matcher $string? accessor-matcher* | $string accessor-matcher* | accessor-matcher+
|
||||||
|
type-matcher := "(" q-ws* ")" | $type
|
||||||
accessor-matcher := "[" q-ws* (comparison | accessor)? q-ws* "]"
|
accessor-matcher := "[" q-ws* (comparison | accessor)? q-ws* "]"
|
||||||
comparison := accessor q-ws* matcher-operator q-ws* (type | identifier | string | number | keyword)
|
comparison := accessor q-ws* matcher-operator q-ws* ($type | $string | $number | $keyword)
|
||||||
accessor := "val(" q-ws* integer q-ws* ")" | "prop(" q-ws* identifier q-ws* ")" | "name(" q-ws* ")" | "tag(" q-ws* ")" | "values(" q-ws* ")" | "props(" q-ws* ")" | identifier
|
accessor := "val(" q-ws* $integer q-ws* ")" | "prop(" q-ws* $string q-ws* ")" | "name(" q-ws* ")" | "tag(" q-ws* ")" | "values(" q-ws* ")" | "props(" q-ws* ")" | $string
|
||||||
matcher-operator := "=" | "!=" | ">" | "<" | ">=" | "<=" | "^=" | "$=" | "*="
|
matcher-operator := "=" | "!=" | ">" | "<" | ">=" | "<=" | "^=" | "$=" | "*="
|
||||||
|
|
||||||
q-ws := unicode-space
|
q-ws := $plain-node-space
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue