summaryrefslogtreecommitdiff
path: root/src/parser.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-05-22 18:45:42 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-05-22 21:35:03 -0400
commita3482606dc33b88d2ae661e49c6b15b902497421 (patch)
tree19d3946e11d0fd8fe0d72859d5bfb3f0e66e7c07 /src/parser.cc
parent3e1ec40551184010d6ff3272d68b3ff17ff1ad26 (diff)
downloadfork-ledger-a3482606dc33b88d2ae661e49c6b15b902497421.tar.gz
fork-ledger-a3482606dc33b88d2ae661e49c6b15b902497421.tar.bz2
fork-ledger-a3482606dc33b88d2ae661e49c6b15b902497421.zip
Improved error reporting in the expression parser
Fixes 15A80F68-F233-49D9-AF0C-9908BB6903BA
Diffstat (limited to 'src/parser.cc')
-rw-r--r--src/parser.cc9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/parser.cc b/src/parser.cc
index e8e987cb..f52949ce 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -79,9 +79,7 @@ expr_t::parser_t::parse_value_term(std::istream& in,
case token_t::LPAREN:
node = parse_value_expr(in, tflags.plus_flags(PARSE_PARTIAL)
.minus_flags(PARSE_SINGLE));
- tok = next_token(in, tflags);
- if (tok.kind != token_t::RPAREN)
- tok.expected(')');
+ tok = next_token(in, tflags, ')');
if (node->kind == op_t::O_CONS) {
ptr_op_t prev(node);
@@ -383,10 +381,7 @@ expr_t::parser_t::parse_querycolon_expr(std::istream& in,
throw_(parse_error,
_("%1 operator not followed by argument") << tok.symbol);
- token_t& next_tok = next_token(in, tflags.plus_flags(PARSE_OP_CONTEXT));
- if (next_tok.kind != token_t::COLON)
- next_tok.expected(':');
-
+ next_token(in, tflags.plus_flags(PARSE_OP_CONTEXT), ':');
prev = node->right();
ptr_op_t subnode = new op_t(op_t::O_COLON);
subnode->set_left(prev);