#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include namespace ovdl::v2script { using FileNode = ast::FileNode; class Parser final : public detail::BasicParser { public: Parser(); static Parser from_buffer(const char* data, std::size_t size); static Parser from_buffer(const char* start, const char* end); static Parser from_string(const std::string_view string); static Parser from_file(const char* path); static Parser from_file(const std::filesystem::path& path); constexpr Parser& load_from_buffer(const char* data, std::size_t size); constexpr Parser& load_from_buffer(const char* start, const char* end); constexpr Parser& load_from_string(const std::string_view string); constexpr Parser& load_from_file(const char* path); Parser& load_from_file(const std::filesystem::path& path); constexpr Parser& load_from_file(const detail::Has_c_str auto& path); bool simple_parse(); bool event_parse(); bool decision_parse(); const FileNode* get_file_node() const; Parser(Parser&&); Parser& operator=(Parser&&); ~Parser(); private: class BufferHandler; std::unique_ptr _buffer_handler; std::unique_ptr _file_node; template constexpr void _run_load_func(detail::LoadCallback auto func, Args... args); }; }