From 252bde8542222953f4432c166d83ba6775a546da Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 18 Apr 2018 13:29:44 +0100 Subject: Introduce Token::friendlyName() helper --- libsolidity/parsing/Token.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libsolidity/parsing/Token.h') diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h index 805fbf5d..4d7a7bc6 100644 --- a/libsolidity/parsing/Token.h +++ b/libsolidity/parsing/Token.h @@ -304,6 +304,17 @@ public: return m_string[tok]; } + static std::string friendlyName(Value tok) + { + char const* ret = toString(tok); + if (ret == nullptr) + { + ret = name(tok); + solAssert(ret != nullptr, ""); + } + return std::string(ret); + } + // @returns the precedence > 0 for binary and compare // operators; returns 0 otherwise. static int precedence(Value tok) -- cgit