aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/make-parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-12-06 08:33:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-12-06 08:33:15 +0200
commit2006284bfbda3416eb8348078fd98fa518d25c47 (patch)
tree960d8495e1d4a011348ab719fa486af49a50f912 /libbuild2/make-parser.cxx
parentdcd8ccd86ca97de5293efc50f98d7072ee359e4c (diff)
Redo make_parser interface to return path, handle invalid_path exception
Diffstat (limited to 'libbuild2/make-parser.cxx')
-rw-r--r--libbuild2/make-parser.cxx13
1 files changed, 11 insertions, 2 deletions
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<type, string>
+ bool strict) -> pair<type, path>
{
assert (state != end);
@@ -55,7 +55,16 @@ namespace build2
state = end; // Not a mere optimization: the caller will get next line.
}
- return pair<type, string> (t, move (r.first));
+ try
+ {
+ return pair<type, path> (t, path (move (r.first)));
+ }
+ catch (const invalid_path& e)
+ {
+ fail (ll) << "invalid make "
+ << (t == type::prereq ? "prerequisite" : "target")
+ << " path '" << e.path << "'" << endf;
+ }
}
pair<string, bool> make_parser::