diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-18 07:14:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-18 07:14:53 +0200 |
commit | c0c85b67516653c181fbce7c61c2df3e31e4edd8 (patch) | |
tree | 535467b029b27b190e35064e4babd62825eba6a1 /build/parser | |
parent | 835ed5f7080a98e9ee80ac08d5585ccdbb63fe0e (diff) |
Initial support for loading dependency info from buildfiles
Also a new iteration on the overall architecture. Now, for the first time,
build can read the buildfile and build itself.
g++-4.9 -std=c++14 -g -I.. -o bd bd.cxx algorithm.cxx scope.cxx parser.cxx lexer.cxx target.cxx prerequisite.cxx rule.cxx native.cxx cxx/target.cxx cxx/rule.cxx process.cxx timestamp.cxx path.cxx
g++-4.9 -std=c++14 -g -I../../.. -o driver driver.cxx ../../../build/lexer.cxx
g++-4.9 -std=c++14 -g -I../../.. -o driver driver.cxx ../../../build/lexer.cxx ../../../build/parser.cxx ../../../build/scope.cxx ../../../build/target.cxx ../../../build/native.cxx ../../../build/prerequisite.cxx ../../../build/path.cxx ../../../build/timestamp.cxx
Diffstat (limited to 'build/parser')
-rw-r--r-- | build/parser | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/build/parser b/build/parser index c487015..e8e7314 100644 --- a/build/parser +++ b/build/parser @@ -8,12 +8,16 @@ #include <string> #include <vector> #include <iosfwd> +#include <utility> // std::move #include <exception> + #include <build/path> namespace build { + class scope; + class token; enum class token_type; class lexer; @@ -28,12 +32,21 @@ namespace build parser (std::ostream& diag): diag_ (diag) {} void - parse (std::istream&, const path&); + parse (std::istream&, const path&, scope&); // Recursive descent parser. // private: - typedef std::vector<std::string> names; + struct name_type + { + name_type (std::string t, std::string n) + : type (std::move (t)), name (std::move (n)) {} + + std::string type; // Empty if untyped. + std::string name; + }; + + typedef std::vector<name_type> names; void parse_clause (token&, token_type&); @@ -42,12 +55,12 @@ namespace build parse_names (token& t, token_type& tt) { names ns; - parse_names (t, tt, ns); + parse_names (t, tt, ns, nullptr); return ns; } void - parse_names (token&, token_type&, names&); + parse_names (token&, token_type&, names&, const std::string* type); // Utilities. // @@ -63,6 +76,7 @@ namespace build lexer* lexer_; const path* path_; + scope* scope_; }; } |