summaryrefslogtreecommitdiff
path: root/src/query.cc
diff options
context:
space:
mode:
authorGwyneth Morgan <gwymor@tilde.club>2023-09-12 19:50:24 +0000
committerJohn Wiegley <johnw@newartisans.com>2023-10-12 13:55:48 -0700
commitf480f37a847100d351a970a1b83a86d9eeccbcc7 (patch)
tree1d47f591c525e948496a38195e22d5b11b80b484 /src/query.cc
parent4355c4faf157d5ef47b126286aa501742732708d (diff)
downloadfork-ledger-f480f37a847100d351a970a1b83a86d9eeccbcc7.tar.gz
fork-ledger-f480f37a847100d351a970a1b83a86d9eeccbcc7.tar.bz2
fork-ledger-f480f37a847100d351a970a1b83a86d9eeccbcc7.zip
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
Diffstat (limited to 'src/query.cc')
-rw-r--r--src/query.cc4
1 files changed, 4 insertions, 0 deletions
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);