From 22eff22492b2d569fe56b59763ddc1cd1cf9ccf4 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 28 Nov 2018 16:13:36 +0100 Subject: liblangutil: extends CharStream to know about the respective (file-)name (and adapt codebase to it) --- liblangutil/CharStream.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'liblangutil/CharStream.h') diff --git a/liblangutil/CharStream.h b/liblangutil/CharStream.h index 72aacacf..6f2da3bb 100644 --- a/liblangutil/CharStream.h +++ b/liblangutil/CharStream.h @@ -68,7 +68,8 @@ class CharStream { public: CharStream(): m_position(0) {} - explicit CharStream(std::string const& _source): m_source(_source), m_position(0) {} + explicit CharStream(std::string const& _source, std::string const& name): + m_source(_source), m_name(name), m_position(0) {} int position() const { return m_position; } bool isPastEndOfInput(size_t _charsForward = 0) const { return (m_position + _charsForward) >= m_source.size(); } @@ -80,6 +81,7 @@ public: void reset() { m_position = 0; } std::string const& source() const { return m_source; } + std::string const& name() const noexcept { return m_name; } ///@{ ///@name Error printing helper functions @@ -91,6 +93,7 @@ public: private: std::string m_source; + std::string m_name; size_t m_position; }; -- cgit