From 2006284bfbda3416eb8348078fd98fa518d25c47 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 Dec 2021 08:33:15 +0200 Subject: Redo make_parser interface to return path, handle invalid_path exception --- libbuild2/make-parser.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libbuild2/make-parser.cxx') diff --git a/libbuild2/make-parser.cxx b/libbuild2/make-parser.cxx index d076a0a..cab81d0 100644 --- a/libbuild2/make-parser.cxx +++ b/libbuild2/make-parser.cxx @@ -11,7 +11,7 @@ namespace build2 next (const string& l, size_t& p, const location& ll, - bool strict) -> pair + bool strict) -> pair { assert (state != end); @@ -55,7 +55,16 @@ namespace build2 state = end; // Not a mere optimization: the caller will get next line. } - return pair (t, move (r.first)); + try + { + return pair (t, path (move (r.first))); + } + catch (const invalid_path& e) + { + fail (ll) << "invalid make " + << (t == type::prereq ? "prerequisite" : "target") + << " path '" << e.path << "'" << endf; + } } pair make_parser:: -- cgit v1.1