// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Shader module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_SHADER_AST_ASTREFLECT_HPP #define NAZARA_SHADER_AST_ASTREFLECT_HPP #include #include #include #include namespace Nz::ShaderAst { class NAZARA_SHADER_API AstReflect : public AstRecursiveVisitor { public: struct Callbacks; AstReflect() = default; AstReflect(const AstReflect&) = delete; AstReflect(AstReflect&&) = delete; ~AstReflect() = default; void Reflect(Statement& statement, const Callbacks& callbacks); AstReflect& operator=(const AstReflect&) = delete; AstReflect& operator=(AstReflect&&) = delete; struct Callbacks { std::function onEntryPointDeclaration; std::function onAliasDeclaration; std::function onConstDeclaration; std::function onExternalDeclaration; std::function onFunctionDeclaration; std::function onOptionDeclaration; std::function onStructDeclaration; std::function onVariableDeclaration; std::function onAliasIndex; std::function onConstIndex; std::function onFunctionIndex; std::function onOptionIndex; std::function onStructIndex; std::function onVariableIndex; }; private: void Visit(DeclareAliasStatement& node) override; void Visit(DeclareConstStatement& node) override; void Visit(DeclareExternalStatement& node) override; void Visit(DeclareFunctionStatement& node) override; void Visit(DeclareOptionStatement& node) override; void Visit(DeclareStructStatement& node) override; void Visit(DeclareVariableStatement& node) override; void Visit(ForStatement& node) override; void Visit(ForEachStatement& node) override; const Callbacks* m_callbacks; }; } #include #endif // NAZARA_SHADER_AST_ASTREFLECT_HPP