diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-16 00:15:25 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-16 00:15:25 -0500 |
commit | 6b557f810e1c6eb2dcd8a24eeeacfcf9cc8210e3 (patch) | |
tree | 52b5e0dfa040fd878ac4817a0fd49cee7c6f1688 /src/query.cc | |
parent | badbeb545b9e700e6656dfbc348bfe1387cb2ffa (diff) | |
parent | b2c426abaed18e0784e39f804dcae0324e21f32f (diff) | |
download | fork-ledger-6b557f810e1c6eb2dcd8a24eeeacfcf9cc8210e3.tar.gz fork-ledger-6b557f810e1c6eb2dcd8a24eeeacfcf9cc8210e3.tar.bz2 fork-ledger-6b557f810e1c6eb2dcd8a24eeeacfcf9cc8210e3.zip |
Merge branch 'next'
Diffstat (limited to 'src/query.cc')
-rw-r--r-- | src/query.cc | 18 |
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 |