Expand description
§The query language supported by git-bug-rs
The language is not really connected to any state on disk, but is a quite
convenient tool to query the on-disk state. As such it is currently part of
git-bug-rs.
In general, the EBNF grammar of the query language is as follows:
Query = Matcher;
Matcher = Or | And | MatchKey;
Or = "(" Matcher Break "OR" Break Matcher ")";
And = "(" Matcher Break "AND" Break Matcher ")";
Break = " ";
MatchKey = Key ":" Value;
Key = {CHAR}; {* Further specified by the Queryable object *}
Value = {CHAR}; {* Further specified by the Queryable object *}This is obviously rather unwieldy to expect people to actually input (e.g.,
just querying for open issues that contain the string “test” in their title
would take: (status:open AND title:test). If we now also wanted to add a
specific label to the query, we would need to write ((status:open AND title:test) AND label:ack).)
To avoid this, the query language has parsers for two forms, a strict one and a relaxed one.
The relaxed one tries to simplify the query language by inserting defaults or making educated guesses; it that can be normalized through insertion of default conjunctions or keys to the strict query language.
The strict parser rejects all input that does not comply with the EBNF grammar.
For example, following expressions would be accepted with the relaxed parser:
status:open title:test label:ack(implicitly insertingANDsbetween theMatchKeys)systemd stage 1 init(implicitly insertingANDsand search keys for each value.)
See the test cases in the strict and relaxed parser for more examples.
Modules§
- normalize
- Normalization of a
Query. - parse
- Parsing of a
Query. - queryable
- The actual code to match an
EntityfromQuery.
Structs§
- Query
- The container and root for queries.