diff options
author | Christian <c@ethdev.com> | 2014-10-09 02:53:50 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-09 02:53:50 +0800 |
commit | 0a1ebe4f516a5c1e8ebc12798a94529bdda9b6df (patch) | |
tree | dcc068f33caaa625872b1c1e612f6c362b13145f /Scanner.h | |
parent | 56e9cc8db71f8af949123e13e6a97cc056cf766d (diff) | |
download | dexon-solidity-0a1ebe4f516a5c1e8ebc12798a94529bdda9b6df.tar.gz dexon-solidity-0a1ebe4f516a5c1e8ebc12798a94529bdda9b6df.tar.zst dexon-solidity-0a1ebe4f516a5c1e8ebc12798a94529bdda9b6df.zip |
Parse everything up to function bodies and report parser errors with location.
Diffstat (limited to 'Scanner.h')
-rw-r--r-- | Scanner.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -82,6 +82,12 @@ public: return get(); } + /// Functions that help pretty-printing parse errors + /// Do only use in error cases, they are quite expensive. + /// @{ + std::string getLineAtPosition(int _position) const; + std::tuple<int, int> translatePositionToLineColumn(int _position) const; + /// @} private: std::string m_source; size_t m_pos; @@ -134,6 +140,16 @@ public: Location peekLocation() const { return m_next_token.location; } const std::string& peekLiteral() const { return m_next_token.literal; } + /// Functions that help pretty-printing parse errors. + /// Do only use in error cases, they are quite expensive. + /// @{ + std::string getLineAtPosition(int _position) const { return m_source.getLineAtPosition(_position); } + std::tuple<int, int> translatePositionToLineColumn(int _position) const + { + return m_source.translatePositionToLineColumn(_position); + } + /// @} + // Returns true if there was a line terminator before the peek'ed token, // possibly inside a multi-line comment. bool hasAnyLineTerminatorBeforeNext() const { |