summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'valexpr.cc')
-rw-r--r--valexpr.cc32
1 files changed, 12 insertions, 20 deletions
diff --git a/valexpr.cc b/valexpr.cc
index 5b5d29ba..4fed821e 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -772,29 +772,21 @@ value_expr_t * parse_value_term(std::istream& in, scope_t * scope,
// When in relaxed parsing mode, we do want to migrate commodity
// flags, so that any precision specified by the user updates
// the current maximum precision displayed.
- try {
- pos = (long)in.tellg();
+ pos = (long)in.tellg();
- unsigned char parse_flags = 0;
- if (flags & PARSE_VALEXPR_NO_MIGRATE)
- parse_flags |= AMOUNT_PARSE_NO_MIGRATE;
- if (flags & PARSE_VALEXPR_NO_REDUCE)
- parse_flags |= AMOUNT_PARSE_NO_REDUCE;
+ unsigned char parse_flags = 0;
+ if (flags & PARSE_VALEXPR_NO_MIGRATE)
+ parse_flags |= AMOUNT_PARSE_NO_MIGRATE;
+ if (flags & PARSE_VALEXPR_NO_REDUCE)
+ parse_flags |= AMOUNT_PARSE_NO_REDUCE;
- temp.parse(in, parse_flags);
- }
- catch (amount_error * err) {
- // If the amount had no commodity, it must be an unambiguous
- // variable reference
- if (std::strcmp(err->what(), "No quantity specified for amount") == 0) {
- in.clear();
- in.seekg(pos, std::ios::beg);
- c = prev_c;
- goto parse_ident;
- } else {
- throw err;
- }
+ if (! temp.parse(in, parse_flags | AMOUNT_PARSE_SOFT_FAIL)) {
+ in.clear();
+ in.seekg(pos, std::ios::beg);
+ c = prev_c;
+ goto parse_ident;
}
+
node.reset(new value_expr_t(value_expr_t::CONSTANT));
node->value = new value_t(temp);
goto parsed;