aboutsummaryrefslogtreecommitdiff
path: root/build2/parser
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-21 12:05:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-21 12:05:31 +0200
commit141693278ef900655efae53990d084058b008a90 (patch)
tree5b247e57d279a5f40e380d8ca35e871332d82712 /build2/parser
parent4a5c11f559e72bb6f5d8c28815c57c1690408f29 (diff)
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 }
Diffstat (limited to 'build2/parser')
-rw-r--r--build2/parser11
1 files changed, 9 insertions, 2 deletions
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&);