Shader: Add support for error messages (WIP)
This commit is contained in:
committed by
Jérôme Leclercq
parent
f14b10baf4
commit
ebad7b5e8c
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Shader/Config.hpp>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
@@ -28,35 +29,11 @@ namespace Nz::ShaderLang
|
||||
unsigned int column;
|
||||
unsigned int line;
|
||||
TokenType type;
|
||||
std::shared_ptr<const std::string> file;
|
||||
std::variant<double, long long, std::string> data;
|
||||
};
|
||||
|
||||
class BadNumber : public std::exception
|
||||
{
|
||||
using exception::exception;
|
||||
};
|
||||
|
||||
class NumberOutOfRange : public std::exception
|
||||
{
|
||||
using exception::exception;
|
||||
};
|
||||
|
||||
class UnfinishedString : public std::exception
|
||||
{
|
||||
using exception::exception;
|
||||
};
|
||||
|
||||
class UnrecognizedChar : public std::exception
|
||||
{
|
||||
using exception::exception;
|
||||
};
|
||||
|
||||
class UnrecognizedToken : public std::exception
|
||||
{
|
||||
using exception::exception;
|
||||
};
|
||||
|
||||
NAZARA_SHADER_API std::vector<Token> Tokenize(const std::string_view& str);
|
||||
NAZARA_SHADER_API std::vector<Token> Tokenize(const std::string_view& str, const std::string& filePath = std::string{});
|
||||
NAZARA_SHADER_API const char* ToString(TokenType tokenType);
|
||||
NAZARA_SHADER_API std::string ToString(const std::vector<Token>& tokens, bool pretty = true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user