diff options
author | Christian Parpart <christian@ethereum.org> | 2018-11-28 23:13:36 +0800 |
---|---|---|
committer | Christian Parpart <christian@ethereum.org> | 2018-11-29 19:45:27 +0800 |
commit | 22eff22492b2d569fe56b59763ddc1cd1cf9ccf4 (patch) | |
tree | ea6dc0a75a3c1c7d189ec9bb899884cc4f3eefd6 /liblangutil | |
parent | 6060a3682c077d7b329ec9171abdacbf1b383ec7 (diff) | |
download | dexon-solidity-22eff22492b2d569fe56b59763ddc1cd1cf9ccf4.tar.gz dexon-solidity-22eff22492b2d569fe56b59763ddc1cd1cf9ccf4.tar.zst dexon-solidity-22eff22492b2d569fe56b59763ddc1cd1cf9ccf4.zip |
liblangutil: extends CharStream to know about the respective (file-)name (and adapt codebase to it)
Diffstat (limited to 'liblangutil')
-rw-r--r-- | liblangutil/CharStream.h | 5 |
1 files changed, 4 insertions, 1 deletions
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; }; |