iterate a bit on KQL

This commit is contained in:
Kat Marchán 2024-02-11 21:05:23 -08:00
parent abae1f9a39
commit 7ab86588c0
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
2 changed files with 13 additions and 6 deletions

View File

@ -74,4 +74,7 @@
spaces for that purpose.
* The "any sibling" selector is now `++` instead of `~`, for consistency with
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.

View File

@ -104,18 +104,22 @@ Then the following queries are valid:
## 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
selector := filter q-ws* selector-operator q-ws* selector | filter
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* "]"
comparison := accessor q-ws* matcher-operator q-ws* (type | identifier | 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
comparison := accessor q-ws* matcher-operator q-ws* ($type | $string | $number | $keyword)
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 := "=" | "!=" | ">" | "<" | ">=" | "<=" | "^=" | "$=" | "*="
q-ws := unicode-space
q-ws := $plain-node-space
```