diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-19 14:02:44 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-19 14:02:44 -0400 |
commit | 7995e167623ca0ec473a3c0c974d99b244e2c5b6 (patch) | |
tree | f520a4afd028190e58741fe2c95c3e9c3e1d739d | |
parent | 9b905f2b44dc3c379c20eeec5ba4c9ecb4331577 (diff) | |
download | fork-ledger-7995e167623ca0ec473a3c0c974d99b244e2c5b6.tar.gz fork-ledger-7995e167623ca0ec473a3c0c974d99b244e2c5b6.tar.bz2 fork-ledger-7995e167623ca0ec473a3c0c974d99b244e2c5b6.zip |
Corrected a bug in report query parsing
-rw-r--r-- | src/query.cc | 4 | ||||
-rw-r--r-- | test/unit/t_expr.cc | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/query.cc b/src/query.cc index 404c101f..907f3fd5 100644 --- a/src/query.cc +++ b/src/query.cc @@ -53,6 +53,7 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token() } } + resume: switch (*arg_i) { case '\'': case '"': @@ -88,7 +89,6 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token() return tok; } - resume: bool consume_next = false; switch (*arg_i) { case ' ': @@ -125,7 +125,7 @@ query_t::lexer_t::token_t query_t::lexer_t::next_token() case '\t': case '\n': case '\r': - if (! consume_whitespace) + if (! multiple_args && ! consume_whitespace) goto test_ident; else ident.push_back(*arg_i); diff --git a/test/unit/t_expr.cc b/test/unit/t_expr.cc index 0d88be9e..d9dc1f1f 100644 --- a/test/unit/t_expr.cc +++ b/test/unit/t_expr.cc @@ -63,7 +63,7 @@ void ValueExprTestCase::testPredicateTokenizer2() args.push_back(string_value("foo and bar")); #ifndef NOT_FOR_PYTHON - query_t::lexer_t tokens(args.begin(), args.end()); + query_t::lexer_t tokens(args.begin(), args.end(), false); assertEqual(query_t::lexer_t::token_t::TERM, tokens.next_token().kind); assertEqual(query_t::lexer_t::token_t::TOK_AND, tokens.next_token().kind); @@ -119,7 +119,7 @@ void ValueExprTestCase::testPredicateTokenizer5() args.push_back(string_value("bar)")); #ifndef NOT_FOR_PYTHON - query_t::lexer_t tokens(args.begin(), args.end()); + query_t::lexer_t tokens(args.begin(), args.end(), false); assertEqual(query_t::lexer_t::token_t::LPAREN, tokens.next_token().kind); assertEqual(query_t::lexer_t::token_t::TERM, tokens.next_token().kind); @@ -168,7 +168,7 @@ void ValueExprTestCase::testPredicateTokenizer8() args.push_back(string_value("expr 'foo and bar'")); #ifndef NOT_FOR_PYTHON - query_t::lexer_t tokens(args.begin(), args.end()); + query_t::lexer_t tokens(args.begin(), args.end(), false); assertEqual(query_t::lexer_t::token_t::TOK_EXPR, tokens.next_token().kind); assertEqual(query_t::lexer_t::token_t::TERM, tokens.next_token().kind); @@ -318,7 +318,7 @@ void ValueExprTestCase::testPredicateTokenizer16() args.push_back(string_value("and bar|baz")); #ifndef NOT_FOR_PYTHON - query_t::lexer_t tokens(args.begin(), args.end()); + query_t::lexer_t tokens(args.begin(), args.end(), false); assertEqual(query_t::lexer_t::token_t::TERM, tokens.next_token().kind); assertEqual(query_t::lexer_t::token_t::TOK_AND, tokens.next_token().kind); |