aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Token.h
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-04-18 20:29:44 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-05-04 20:11:23 +0800
commit252bde8542222953f4432c166d83ba6775a546da (patch)
tree65f823ba8ec935c2023b603099465aab934d2b23 /libsolidity/parsing/Token.h
parente3279d8af89c9b5e99e6bca206cb5ce6ef5b0291 (diff)
downloaddexon-solidity-252bde8542222953f4432c166d83ba6775a546da.tar.gz
dexon-solidity-252bde8542222953f4432c166d83ba6775a546da.tar.zst
dexon-solidity-252bde8542222953f4432c166d83ba6775a546da.zip
Introduce Token::friendlyName() helper
Diffstat (limited to 'libsolidity/parsing/Token.h')
-rw-r--r--libsolidity/parsing/Token.h11
1 files changed, 11 insertions, 0 deletions
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)