// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - Renderer module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_SHADER_LANGLEXER_HPP #define NAZARA_SHADER_LANGLEXER_HPP #include #include #include #include #include #include namespace Nz::ShaderLang { enum class TokenType { #define NAZARA_SHADERLANG_TOKEN(X) X, #include }; struct Token { unsigned int column; unsigned int line; TokenType type; std::variant data; }; class BadNumber : public std::exception { using exception::exception; }; class NumberOutOfRange : public std::exception { using exception::exception; }; class UnrecognizedToken : public std::exception { using exception::exception; }; NAZARA_SHADER_API std::vector Tokenize(const std::string_view& str); NAZARA_SHADER_API const char* ToString(TokenType tokenType); NAZARA_SHADER_API std::string ToString(const std::vector& tokens, bool pretty = true); } #include #endif