From 141693278ef900655efae53990d084058b008a90 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jul 2016 12:05:31 +0200 Subject: Add support for single line if-blocks So now we can do: if true print true else print false Instead having to do: if true { print true } else { print false } --- build2/parser | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'build2/parser') diff --git a/build2/parser b/build2/parser index 0962348..af5c500 100644 --- a/build2/parser +++ b/build2/parser @@ -56,8 +56,15 @@ namespace build2 // Recursive descent parser. // protected: - void - clause (token&, token_type&); + // If one is true then parse a single (logical) line (logical means it + // can actually be several lines, e.g., an if-block). Return false if + // nothing has been parsed (i.e., we are on the same token). + // + // Note that after this function returns, the token is the first token on + // the next line (or eos). + // + bool + clause (token&, token_type&, bool one = false); void print (token&, token_type&); -- cgit v1.1