26 lines
1.0 KiB
C++
26 lines
1.0 KiB
C++
#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::UnknownCharacter:
|
|
return util::Format("Unknown character: '{0}'", diag->GetFormats());
|
|
case DiagnosticType::ExpectedEndOfString:
|
|
return util::Format("Expected end of string, found {0}", diag->GetFormats());
|
|
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
|