From f480f37a847100d351a970a1b83a86d9eeccbcc7 Mon Sep 17 00:00:00 2001 From: Gwyneth Morgan Date: Tue, 12 Sep 2023 19:50:24 +0000 Subject: Fix =regex note query syntax The manpage documents `=regex` as equivalent to the `note regex` query syntax, but the former does not actually work as the parser only handles an equals sign in the case of `tag type=dining` syntax, and doesn't handle the case where an equals sign starts a note query. Fixing this does break queries like `tag type = dining` with spaces around the equals sign, but that syntax was not intended or documented. Closes: #2275 --- src/query.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/query.cc b/src/query.cc index 945bd34c..705ba151 100644 --- a/src/query.cc +++ b/src/query.cc @@ -126,6 +126,10 @@ query_t::lexer_t::next_token(query_t::lexer_t::token_t::kind_t tok_context) case '#': ++arg_i; return token_t(token_t::TOK_CODE); case '%': ++arg_i; return token_t(token_t::TOK_META); case '=': + if (arg_i == (*begin).as_string().begin()) { + ++arg_i; + return token_t(token_t::TOK_NOTE); + } ++arg_i; consume_next = true; return token_t(token_t::TOK_EQ); -- cgit v1.2.3