diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-07 09:18:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-07 09:18:22 +0200 |
commit | 49d5628e35593a5300d39596286c768d7aa435b6 (patch) | |
tree | 43f20983a381c54aac7536e78e4f9543d8761aac /build/parser.cxx | |
parent | 16c19b739a58845af7f807c3dee8021a1c421006 (diff) |
Rework module architecture
Now the target type and rule maps are in scopes (builtins -- in global
scope). We also now have the map of loaded modules in the root scope of
each project.
Diffstat (limited to 'build/parser.cxx')
-rw-r--r-- | build/parser.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/build/parser.cxx b/build/parser.cxx index c8bc241..59e3783 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -261,7 +261,7 @@ namespace build auto enter_target = [this, &nloc, &trace] (name&& tn) -> target& { const string* e; - const target_type* ti (target_types.find (tn, e)); + const target_type* ti (scope_->find_target_type (tn, e)); if (ti == nullptr) fail (nloc) << "unknown target type " << tn.type; @@ -335,7 +335,7 @@ namespace build for (auto& pn: pns) { const string* e; - const target_type* ti (target_types.find (pn, e)); + const target_type* ti (scope_->find_target_type (pn, e)); if (ti == nullptr) fail (ploc) << "unknown target type " << pn.type; @@ -720,16 +720,10 @@ namespace build { // For now it should be a simple name. // - if (!n.type.empty () || !n.dir.empty ()) + if (!n.simple ()) fail (l) << "module name expected instead of " << n; - const string& name (n.value); - auto i (modules.find (name)); - - if (i == modules.end ()) - fail (l) << "unknown module " << name; - - i->second (*root_, *scope_, l); + load_module (n.value, *root_, *scope_, l); } if (tt == type::newline) |