MalachScript/src/Diagnostics/DiagnosticTypeEN_US.hpp

25 lines
1007 B
C++
Raw Normal View History

#ifndef MALACHSCRIPT_DIAGNOSTICTYPEEN_US_HPP
#define MALACHSCRIPT_DIAGNOSTICTYPEEN_US_HPP
#include "../../extern/format.hpp"
#include "Diagnostic.hpp"
namespace MalachScript::Diagnostics {
class DiagnosticTypeHelper {
public:
static std::string ToEnglishString(const Diagnostic* diag) {
switch (diag->GetType()) {
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 util::Format("Unexpected Token. Expected any of: {0}, but found {1}", diag->GetFormats());
case DiagnosticType::DoubleProperty: return "Property block found twice.";
}
return std::to_string((uint8_t)diag->GetType());
}
};
}
#endif // MALACHSCRIPT_DIAGNOSTICTYPEEN_US_HPP