diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-12 11:30:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-12 11:30:04 +0200 |
commit | 257ad3c2c5e633d2fd3f2228021ac3ae8d6d07cb (patch) | |
tree | ecfa5df6e8abca5bd483d5498bf84412ae58930e /build/lexer | |
parent | 0dcf07989b4b942f6ff872023b2886b7f698d711 (diff) |
Initial buildfile parser implementation
g++-4.9 -std=c++14 -g -I../../.. -o driver driver.cxx ../../../build/lexer.cxx ../../../build/parser.cxx && ./driver
Diffstat (limited to 'build/lexer')
-rw-r--r-- | build/lexer | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/build/lexer b/build/lexer index 34b6fcc..cf67eec 100644 --- a/build/lexer +++ b/build/lexer @@ -21,11 +21,8 @@ namespace build class lexer { public: - // If name is empty, then no diagnostics is issued, just lexer_error - // is thrown (use for testing). - // - lexer (std::istream& is, const std::string& name) - : is_ (is), name_ (name) {} + lexer (std::istream& is, const std::string& name, std::ostream& diag) + : is_ (is), name_ (name), diag_ (diag) {} token next (); @@ -74,6 +71,8 @@ namespace build return c.value () == xchar::traits_type::eof (); } + // Scanner. + // private: xchar escape (); @@ -84,9 +83,16 @@ namespace build token name (xchar); + // Utilities. + // + private: + std::ostream& + error (const xchar&); + private: std::istream& is_; std::string name_; + std::ostream& diag_; std::uint64_t l_ {1}; std::uint64_t c_ {1}; |