summaryrefslogtreecommitdiff
path: root/src/query.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-15 05:17:17 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-15 05:49:54 -0500
commit2a411b5c1d974b73471f1f7c9a79db204c79d1d9 (patch)
tree2ceafc01d749afb982eb9600fd8a175b0c94b008 /src/query.cc
parent38e165a99408b9020ff2ea6fea5449f7a7e58698 (diff)
downloadfork-ledger-2a411b5c1d974b73471f1f7c9a79db204c79d1d9.tar.gz
fork-ledger-2a411b5c1d974b73471f1f7c9a79db204c79d1d9.tar.bz2
fork-ledger-2a411b5c1d974b73471f1f7c9a79db204c79d1d9.zip
Corrected parsing of the 'expr' report query term
Diffstat (limited to 'src/query.cc')
-rw-r--r--src/query.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/query.cc b/src/query.cc
index 21304f92..bf4eb62a 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -53,6 +53,12 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token()
}
}
+ if (consume_next_arg) {
+ consume_next_arg = false;
+ arg_i = arg_end;
+ return token_t(token_t::TERM, (*begin).as_string());
+ }
+
resume:
bool consume_next = false;
switch (*arg_i) {
@@ -95,13 +101,7 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token()
case '@': ++arg_i; return token_t(token_t::TOK_PAYEE);
case '#': ++arg_i; return token_t(token_t::TOK_CODE);
case '%': ++arg_i; return token_t(token_t::TOK_META);
- case '=':
- // The '=' keyword at the beginning of a string causes the entire string
- // to be taken as an expression.
- if (arg_i == (*begin).as_string().begin())
- consume_whitespace = true;
- ++arg_i;
- return token_t(token_t::TOK_EQ);
+ case '=': ++arg_i; return token_t(token_t::TOK_EQ);
case '\\':
consume_next = true;
@@ -140,7 +140,7 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token()
}
consume_whitespace = false;
- test_ident:
+test_ident:
if (ident == "and")
return token_t(token_t::TOK_AND);
else if (ident == "or")
@@ -177,7 +177,7 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token()
#endif
else if (ident == "expr") {
// The expr keyword takes the whole of the next string as its argument.
- consume_whitespace = true;
+ consume_next_arg = true;
return token_t(token_t::TOK_EXPR);
}
else