2020-10-05 15:45:00 +00:00
|
|
|
#ifndef MALACHSCRIPT_DIAGNOSTICTYPE_HPP
|
|
|
|
#define MALACHSCRIPT_DIAGNOSTICTYPE_HPP
|
2020-10-04 17:38:13 +00:00
|
|
|
#include <string>
|
|
|
|
|
2020-10-05 15:45:00 +00:00
|
|
|
namespace MalachScript::Diagnostics {
|
2020-10-07 20:11:18 +00:00
|
|
|
enum class DiagnosticType : uint8_t {
|
|
|
|
UnknownToken,
|
|
|
|
InvalidNumericalBase,
|
|
|
|
ExpectedEndOfString,
|
|
|
|
UnexpectedToken,
|
|
|
|
};
|
2020-10-04 17:38:13 +00:00
|
|
|
|
|
|
|
class DiagnosticTypeHelper {
|
|
|
|
static std::string ToEnglishString(DiagnosticType type) {
|
|
|
|
switch (type) {
|
|
|
|
case DiagnosticType::UnknownToken: return "Unknown token";
|
|
|
|
case DiagnosticType::InvalidNumericalBase: return "Invalid numerical base";
|
|
|
|
case DiagnosticType::ExpectedEndOfString: return "Expected end of string";
|
2020-10-07 20:11:18 +00:00
|
|
|
case DiagnosticType::UnexpectedToken: return "Unexpected Token";
|
2020-10-04 17:38:13 +00:00
|
|
|
}
|
|
|
|
return std::to_string((uint8_t)type);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-10-05 15:45:00 +00:00
|
|
|
#endif // MALACHSCRIPT_DIAGNOSTICTYPE_HPP
|