aboutsummaryrefslogtreecommitdiffstats
path: root/Scanner.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-09 02:53:50 +0800
committerChristian <c@ethdev.com>2014-10-09 02:53:50 +0800
commit0a1ebe4f516a5c1e8ebc12798a94529bdda9b6df (patch)
treedcc068f33caaa625872b1c1e612f6c362b13145f /Scanner.h
parent56e9cc8db71f8af949123e13e6a97cc056cf766d (diff)
downloaddexon-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.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/Scanner.h b/Scanner.h
index d2dcad29..7b1408c0 100644
--- a/Scanner.h
+++ b/Scanner.h
@@ -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 {