diff options
author | John Wiegley <johnw@newartisans.com> | 2011-11-10 00:48:19 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2011-11-10 00:48:19 -0600 |
commit | 37e9ec8030a2634cbe9b2727f4d5530a582292c7 (patch) | |
tree | 7fb3a1ece2c97c6b034a56b7e47b5754c0150e9b /src/parser.h | |
parent | d493f79651d124481aa49bd0eeea1fdea11e477b (diff) | |
download | fork-ledger-37e9ec8030a2634cbe9b2727f4d5530a582292c7.tar.gz fork-ledger-37e9ec8030a2634cbe9b2727f4d5530a582292c7.tar.bz2 fork-ledger-37e9ec8030a2634cbe9b2727f4d5530a582292c7.zip |
Report an error in the case of '(1' (missing rparen)
Fixes #557
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parser.h b/src/parser.h index 9a65765d..09e12d95 100644 --- a/src/parser.h +++ b/src/parser.h @@ -53,11 +53,15 @@ class expr_t::parser_t : public noncopyable mutable bool use_lookahead; token_t& next_token(std::istream& in, const parse_flags_t& tflags, - const char expecting = '\0') const { + const optional<token_t::kind_t>& expecting = none) const { if (use_lookahead) use_lookahead = false; else - lookahead.next(in, tflags, expecting); + lookahead.next(in, tflags); + + if (expecting && lookahead.kind != *expecting) + lookahead.expected(*expecting); + return lookahead; } |