From 8bd89cfca333e58f6990d7d168649dfc79878f31 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 19 Feb 2015 16:10:03 +0200 Subject: Add support for sourcing/including buildfiles, print, dir{} alias --- build/parser | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'build/parser') diff --git a/build/parser b/build/parser index 7515908..b62e8e7 100644 --- a/build/parser +++ b/build/parser @@ -8,22 +8,23 @@ #include #include #include -#include // std::move +#include // std::move +#include #include +#include #include namespace build { class scope; - - class token; - enum class token_type; class lexer; class parser { public: + parser (): fail (&path_) {} + // Issues diagnostics and throws failed in case of an error. // void @@ -47,6 +48,15 @@ namespace build void parse_clause (token&, token_type&); + void + parse_print (token&, token_type&); + + void + parse_source (token&, token_type&); + + void + parse_include (token&, token_type&); + names parse_names (token& t, token_type& tt) { @@ -65,23 +75,23 @@ namespace build token_type next (token&, token_type&); + token_type + peek (); + // Diagnostics. // private: - struct fail_mark_base: build::fail_mark_base - { - location_prologue - operator() (const token&) const; - - const path* path_; - }; - typedef diag_mark fail_mark; + const fail_mark fail; private: - fail_mark fail; - + const std::string* path_; // Path processed by diagnostic_string(). lexer* lexer_; scope* scope_; + + token peek_ {token_type::eos, 0, 0}; + bool peeked_ {false}; + + std::unordered_set include_; }; } -- cgit v1.1