From 098e3b0043c275cfe195be1c592baf5716ab73e5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 3 Mar 2009 16:02:34 -0400 Subject: Fixed parsing of '(1, 2, (3, 4))' --- src/parser.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/parser.cc') 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: -- cgit v1.2.3