diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-24 08:27:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-24 08:27:04 +0200 |
commit | fdb050b4b1b966683ff00dd14b268fe395492358 (patch) | |
tree | b4da8e293eef9d8682c14cf64f2ed25cc1cc75ab /build/parser.cxx | |
parent | 52925684387496e83425c79f74b29a91943466a7 (diff) |
Use prefix_map for scopes, establish root scope
Diffstat (limited to 'build/parser.cxx')
-rw-r--r-- | build/parser.cxx | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/build/parser.cxx b/build/parser.cxx index 5102c60..9ebf8d3 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -158,8 +158,15 @@ namespace build if (dir) { scope& prev (*scope_); - path p (tns[0].name); + // On Win32 translate the root path to the special empty path. + // Search for root_scope for details. + // +#ifdef _WIN32 + path p (tns[0].name != "/" ? path (tns[0].name) : path ()); +#else + path p (tns[0].name); +#endif if (p.relative ()) p = prev.path () / p; @@ -197,9 +204,14 @@ namespace build // Dependency declaration. // - if (tt == type::name || tt == type::lcbrace || tt == type::newline) + if (tt == type::name || + tt == type::lcbrace || + tt == type::newline || + tt == type::eos) { - names_type pns (tt != type::newline ? names (t, tt) : names_type ()); + names_type pns (tt != type::newline && tt != type::eos + ? names (t, tt) + : names_type ()); // Prepare the prerequisite list. // @@ -224,7 +236,7 @@ namespace build n = move (pn.name); // NOTE: steal! else { - d /= path (pn.name, i); + d /= path (pn.name, i != 0 ? i : 1); // Special case: "/". n.assign (pn.name, i + 1, string::npos); } @@ -292,7 +304,7 @@ namespace build n = move (tn.name); // NOTE: steal! else { - d /= path (tn.name, i); + d /= path (tn.name, i != 0 ? i : 1); // Special case: "/". n.assign (tn.name, i + 1, string::npos); } @@ -630,7 +642,10 @@ namespace build peek () { if (!peeked_) + { peek_ = lexer_->next (); + peeked_ = true; + } return peek_.type (); } |