29 lines
1000 B
C++
29 lines
1000 B
C++
#ifndef MALACHSCRIPT_DIAGNOSTICTYPE_HPP
|
|
#define MALACHSCRIPT_DIAGNOSTICTYPE_HPP
|
|
#include <string>
|
|
|
|
namespace MalachScript::Diagnostics {
|
|
enum class DiagnosticType : uint8_t {
|
|
UnknownToken,
|
|
InvalidNumericalBase,
|
|
ExpectedEndOfString,
|
|
UnexpectedToken,
|
|
DoubleProperty,
|
|
};
|
|
|
|
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";
|
|
case DiagnosticType::UnexpectedToken: return "Unexpected Token";
|
|
case DiagnosticType::DoubleProperty: return "Property block found twice.";
|
|
}
|
|
return std::to_string((uint8_t)type);
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif // MALACHSCRIPT_DIAGNOSTICTYPE_HPP
|