From 4a9ee48613cf5c59e071400280b62358eb79987e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 2 Mar 2015 09:52:59 +0200 Subject: Indicate whether token is separated from previous one by whitespaces --- build/lexer | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'build/lexer') diff --git a/build/lexer b/build/lexer index 1723ae0..67a94c8 100644 --- a/build/lexer +++ b/build/lexer @@ -20,11 +20,11 @@ namespace build public: lexer (std::istream& is, const std::string& name): is_ (is), fail (name) {} + // Scanner. + // token next (); - // Character interface. - // private: class xchar { @@ -50,6 +50,22 @@ namespace build std::uint64_t c_; }; + token + name (xchar, bool separated); + + // Return true we have seen any spaces. Skipped empty lines don't + // count. In other words, we are only interested in spaces that + // are on the same line as the following non-space character. + // + bool + skip_spaces (); + + xchar + escape (); + + // Character interface. + // + private: xchar peek (); @@ -67,18 +83,6 @@ namespace build return c.value () == xchar::traits_type::eof (); } - // Scanner. - // - private: - xchar - escape (); - - void - skip_spaces (); - - token - name (xchar); - // Diagnostics. // private: -- cgit v1.1