diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-30 12:53:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-30 15:30:45 +0200 |
commit | 6b9699f0f2e48961af25843eea9b694d043bd352 (patch) | |
tree | 6989edc16eb0690480d556aae6b83588d495a132 /libbuild2/parser.cxx | |
parent | 12268f7741ba73c75a73fafb6063f1393e485aae (diff) |
Reserve `:` in `case` pattern expression for future match extraction support
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r-- | libbuild2/parser.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index d457c68..a8abbfb 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -2141,7 +2141,7 @@ namespace build2 // multiple `case`s per line/block) optionally followed by the `default` // lines/blocks followed by the closing `}`. // - bool taken (false); // One of the cases/default has been taken. + bool taken (false); // One of the case/default has been taken. bool seen_default (false); auto special = [&seen_default, this] (const token& t, const type& tt) @@ -2279,6 +2279,16 @@ namespace build2 break; } + // We reserve the ':' separator for possible future match + // extraction support: + // + // case '...': x + // info "$x" + // + if (tt == type::colon) + fail (t) << "unexpected ':' (match extraction is not yet " + << "supported)"; + if (tt != type::comma) break; } |