summaryrefslogtreecommitdiff
path: root/src/parser.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-03 16:02:34 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-03 16:02:34 -0400
commit098e3b0043c275cfe195be1c592baf5716ab73e5 (patch)
tree149d0f9d8c29db059cedd010beb9df237e69f343 /src/parser.cc
parent4af1bfdde3118b6abc19ca87ef99d42bec58197b (diff)
downloadfork-ledger-098e3b0043c275cfe195be1c592baf5716ab73e5.tar.gz
fork-ledger-098e3b0043c275cfe195be1c592baf5716ab73e5.tar.bz2
fork-ledger-098e3b0043c275cfe195be1c592baf5716ab73e5.zip
Fixed parsing of '(1, 2, (3, 4))'
Diffstat (limited to 'src/parser.cc')
-rw-r--r--src/parser.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser.cc b/src/parser.cc
index c651385f..15cd4fc6 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -62,6 +62,9 @@ expr_t::parser_t::parse_value_term(std::istream& in,
push_token(tok); // let the parser see it again
node->set_right(parse_value_expr(in, tflags.plus_flags(PARSE_SINGLE)));
+
+ if (node->has_right() && node->right()->kind == op_t::O_CONS)
+ node->set_right(node->right()->left());
} else {
push_token(tok);
}
@@ -74,6 +77,12 @@ expr_t::parser_t::parse_value_term(std::istream& in,
tok = next_token(in, tflags);
if (tok.kind != token_t::RPAREN)
tok.expected(')');
+
+ if (node->kind == op_t::O_CONS) {
+ ptr_op_t prev(node);
+ node = new op_t(op_t::O_CONS);
+ node->set_left(prev);
+ }
break;
default: