diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-02 09:52:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-02 09:52:59 +0200 |
commit | 4a9ee48613cf5c59e071400280b62358eb79987e (patch) | |
tree | 5a5546a3b090f88db00d21caccced186f5765786 /build/lexer | |
parent | fbd3c230d3861084b7316a6d5a8597cb00c9510b (diff) |
Indicate whether token is separated from previous one by whitespaces
Diffstat (limited to 'build/lexer')
-rw-r--r-- | build/lexer | 32 |
1 files changed, 18 insertions, 14 deletions
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: |