diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-10 13:54:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-10 13:54:59 +0200 |
commit | 0d0d9a9c56822919e9794658d31db57f8fc3e2bf (patch) | |
tree | 6dcb1649706dc7fc3f02cd5646b4611b3309fbd1 /build/parser.cxx | |
parent | 5f29fc16fb85a934280e00e54bc6307685c4e05d (diff) |
Implement two-phase initialization of modules loaded from bootstrap.build
Diffstat (limited to 'build/parser.cxx')
-rw-r--r-- | build/parser.cxx | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/build/parser.cxx b/build/parser.cxx index 8cfa665..7f8b570 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -42,10 +42,9 @@ namespace build { enter_buildfile (p); - string rw (diag_relative (p)); // Relative to work. - path_ = &rw; + path_ = &path_pool.find (diag_relative (p)); // Relative to work. - lexer l (is, rw); + lexer l (is, *path_); lexer_ = &l; target_ = nullptr; scope_ = &base; @@ -67,7 +66,7 @@ namespace build token parser:: parse_variable (lexer& l, scope& s, string name, type kind) { - path_ = &l.name (); + path_ = &l.name (); // Note: not pooled. lexer_ = &l; target_ = nullptr; scope_ = &s; @@ -531,11 +530,10 @@ namespace build enter_buildfile (p); - string rw (diag_relative (p)); // Relative to work. const string* op (path_); - path_ = &rw; + path_ = &path_pool.find (diag_relative (p)); // Relative to work. - lexer l (ifs, rw); + lexer l (ifs, *path_); lexer* ol (lexer_); lexer_ = &l; @@ -668,11 +666,10 @@ namespace build enter_buildfile (p); - string rw (diag_relative (p)); // Relative to work. const string* op (path_); - path_ = &rw; + path_ = &path_pool.find (diag_relative (p)); // Relative to work. - lexer l (ifs, rw); + lexer l (ifs, *path_); lexer* ol (lexer_); lexer_ = &l; @@ -807,6 +804,9 @@ namespace build bool optional (t.value.back () == '?'); + if (optional && boot_) + fail (t) << "optional module in bootstrap"; + // The rest should be a list of module names. Parse them as names // to get variable expansion, etc. // @@ -856,7 +856,11 @@ namespace build else { assert (v.empty ()); // Module versioning not yet implemented. - load_module (optional, n, *root_, *scope_, l); + + if (boot_) + boot_module (n, *root_, l); + else + load_module (optional, n, *root_, *scope_, l); } } @@ -1838,7 +1842,7 @@ namespace build buildspec parser:: parse_buildspec (istream& is, const std::string& name) { - path_ = &name; + path_ = &name; // Note: caller pools. lexer l (is, name, &paren_processor); lexer_ = &l; |