mirror of https://github.com/kdl-org/kdl.git
KQL: swap around order of comparisons to reduce local ambiguity
generally in {A,E}BNF, if one literal is a prefix of another,
the longer one is specified first, otherwise the shorter one
will always match, either causing a spurious error or a parsing
ambiguity, unless using a parser architecture which automatically
resolved local ambiguities by collecting alternatives.
this is something the rest of the KDL and KQL specs do well,
but it seems this case slipped through the cracks.
This commit is contained in:
parent
11615b2807
commit
8960760112
|
|
@ -125,7 +125,7 @@ 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 | $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* $string q-ws* ")" | "name(" q-ws* ")" | "tag(" q-ws* ")" | "values(" q-ws* ")" | "props(" q-ws* ")" | $string
|
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 := $node-space
|
q-ws := $node-space
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue