summaryrefslogtreecommitdiff
path: root/src/compare.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-09-05 01:38:47 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-09-05 01:38:47 -0400
commite162455ebb545ea33580e58f52ebe424ef9e68fa (patch)
treedf9c98fb39f31b9003db07d7806815bf71031a2d /src/compare.cc
parent9fcf48482626f20151d75a2ebb81371b45d4540a (diff)
downloadfork-ledger-e162455ebb545ea33580e58f52ebe424ef9e68fa.tar.gz
fork-ledger-e162455ebb545ea33580e58f52ebe424ef9e68fa.tar.bz2
fork-ledger-e162455ebb545ea33580e58f52ebe424ef9e68fa.zip
Minor simplifications to valexpr parser
The most significant change is the way CONS sequences are parsed, and that now instead of =/:=, the operators are ==/=.
Diffstat (limited to 'src/compare.cc')
-rw-r--r--src/compare.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compare.cc b/src/compare.cc
index 99e430a7..12114c7d 100644
--- a/src/compare.cc
+++ b/src/compare.cc
@@ -42,8 +42,10 @@ void push_sort_value(std::list<sort_value_t>& sort_values,
expr_t::ptr_op_t node, scope_t& scope)
{
if (node->kind == expr_t::op_t::O_CONS) {
- push_sort_value(sort_values, node->left(), scope);
- push_sort_value(sort_values, node->right(), scope);
+ while (node && node->kind == expr_t::op_t::O_CONS) {
+ push_sort_value(sort_values, node->left(), scope);
+ node = node->right();
+ }
} else {
bool inverted = false;
@@ -54,7 +56,7 @@ void push_sort_value(std::list<sort_value_t>& sort_values,
sort_values.push_back(sort_value_t());
sort_values.back().inverted = inverted;
- sort_values.back().value = expr_t(node).calc(scope).simplified();
+ sort_values.back().value = expr_t(node).calc(scope).simplified();
if (sort_values.back().value.is_null())
throw_(calc_error,