From 6cd17e76c18981ebc24e0fb630373e6386d610b7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 30 Sep 2019 16:29:17 +0200 Subject: Fix bug in for-loop body evaluation --- libbuild2/parser.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libbuild2/parser.cxx') diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 735677e..0a5142f 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -843,7 +843,7 @@ namespace build2 } if (tt != type::rcbrace) - fail (t) << "expected '}' instead of " << t; + fail (t) << "expected name or '}' instead of " << t; next (t, tt); // Presumably newline after '}'. next_after_newline (t, tt, '}'); // Should be on its own line. @@ -2026,8 +2026,8 @@ namespace build2 skip_block (t, tt); if (tt != type::rcbrace) - fail (t) << "expected '}' instead of " << t << " at the end of " << k - << "-block"; + fail (t) << "expected name or '}' instead of " << t + << " at the end of " << k << "-block"; next (t, tt); // Presumably newline after '}'. next_after_newline (t, tt, '}'); // Should be on its own line. @@ -2349,8 +2349,8 @@ namespace build2 skip_block (t, tt); if (tt != type::rcbrace) - fail (t) << "expected '}' instead of " << t << " at the end of " << k - << "-block"; + fail (t) << "expected name or '}' instead of " << t + << " at the end of " << k << "-block"; next (t, tt); // Presumably newline after '}'. next_after_newline (t, tt, '}'); // Should be on its own line. @@ -2517,8 +2517,12 @@ namespace build2 next (t, tt); // { next (t, tt); // } + parse_clause (t, tt); - assert (tt == (block ? type::rcbrace : type::eos)); + + if (tt != (block ? type::rcbrace : type::eos)) + fail (t) << "expected name " << (block ? "or '}' " : "") + << "instead of " << t; lexer_ = ol; -- cgit v1.1