summaryrefslogtreecommitdiff
path: root/tools/common/toml.h
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-05-11 08:02:00 +0800
committerJohn Hodge <tpg@mutabah.net>2018-05-11 08:02:00 +0800
commit174c4f47160dba499c84986d15180fe4307d4adc (patch)
tree9d4f154d404efed09c54e27041eaaa9852773e3b /tools/common/toml.h
parent3b8d8f1a392a2cb5cad1d57d08ced693a0d197d8 (diff)
parentba9b4c4da6b9117529370f402e1015bf1730ccb2 (diff)
downloadmrust-174c4f47160dba499c84986d15180fe4307d4adc.tar.gz
Merge branch 'master' of https://github.com/thepowersgang/mrustc
Diffstat (limited to 'tools/common/toml.h')
-rw-r--r--tools/common/toml.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/common/toml.h b/tools/common/toml.h
index e57c28ae..a2c03bf1 100644
--- a/tools/common/toml.h
+++ b/tools/common/toml.h
@@ -42,7 +42,18 @@ struct TomlValue
String,
Integer,
List,
+
};
+ friend ::std::ostream& operator<<(::std::ostream& os, const Type& e) {
+ switch(e)
+ {
+ case Type::Boolean: os << "boolean"; break;
+ case Type::String: os << "string"; break;
+ case Type::Integer: os << "integer"; break;
+ case Type::List: os << "list"; break;
+ }
+ return os;
+ }
struct TypeError:
public ::std::exception
{
@@ -58,6 +69,10 @@ struct TomlValue
const char* what() const noexcept override {
return "toml type error";
}
+ friend ::std::ostream& operator<<(::std::ostream& os, const TypeError& e) {
+ os << "expected " << e.exp << ", got " << e.have;
+ return os;
+ }
};
Type m_type;