kdl
kdl copied to clipboard
KQL: Add pseudo-matchers (aka pseudo-classes)
We should add support for pseudo-matchers that we can extend KQL with going forward. We can use the reserved #
for the matcher keywords, so:
// select all `foo` nodes that do _not_ have a value.
foo#not([val()])
You can also chain them:
// Select all foo nodes without a value but only if they are the first children.
foo#not([val()])#first-child
We can then add support for tree-structural pseudo-matchers and functional pseudo-matchers.
This will of course increase implementation burden, but it'll also make KQL much more useful (and familiar).