Initial work on parsing.

This commit is contained in:
2020-10-07 22:11:18 +02:00
parent f299d5183f
commit 2036f1ce43
10 changed files with 276 additions and 55 deletions

View File

@@ -3,7 +3,12 @@
#include <string>
namespace MalachScript::Diagnostics {
enum class DiagnosticType : uint8_t { UnknownToken, InvalidNumericalBase, ExpectedEndOfString };
enum class DiagnosticType : uint8_t {
UnknownToken,
InvalidNumericalBase,
ExpectedEndOfString,
UnexpectedToken,
};
class DiagnosticTypeHelper {
static std::string ToEnglishString(DiagnosticType type) {
@@ -11,6 +16,7 @@ namespace MalachScript::Diagnostics {
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";
}
return std::to_string((uint8_t)type);
}