Shader: Add support for error messages (WIP)

This commit is contained in:
SirLynix
2022-03-26 20:23:34 +01:00
committed by Jérôme Leclercq
parent f14b10baf4
commit ebad7b5e8c
11 changed files with 499 additions and 189 deletions

View File

@@ -16,54 +16,6 @@
namespace Nz::ShaderLang
{
class AttributeError : public std::runtime_error
{
public:
using runtime_error::runtime_error;
};
class ExpectedToken : public std::exception
{
public:
using exception::exception;
};
class DuplicateIdentifier : public std::runtime_error
{
public:
using runtime_error::runtime_error;
};
class DuplicateModule : public std::runtime_error
{
public:
using runtime_error::runtime_error;
};
class ReservedKeyword : public std::exception
{
public:
using exception::exception;
};
class UnknownAttribute : public std::exception
{
public:
using exception::exception;
};
class UnknownType : public std::exception
{
public:
using exception::exception;
};
class UnexpectedToken : public std::exception
{
public:
using exception::exception;
};
class NAZARA_SHADER_API Parser
{
public:
@@ -142,7 +94,7 @@ namespace Nz::ShaderLang
Context* m_context;
};
inline ShaderAst::ModulePtr Parse(const std::string_view& source);
inline ShaderAst::ModulePtr Parse(const std::string_view& source, const std::string& filePath = std::string{});
inline ShaderAst::ModulePtr Parse(const std::vector<Token>& tokens);
NAZARA_SHADER_API ShaderAst::ModulePtr ParseFromFile(const std::filesystem::path& sourcePath);
}