diff --git a/include/mqt-core/parsers/qasm3_parser/Parser.hpp b/include/mqt-core/parsers/qasm3_parser/Parser.hpp index 0377ac3d8..d326862c3 100644 --- a/include/mqt-core/parsers/qasm3_parser/Parser.hpp +++ b/include/mqt-core/parsers/qasm3_parser/Parser.hpp @@ -29,13 +29,13 @@ namespace qasm3 { class MQT_CORE_EXPORT Parser { struct ScannerState { private: - std::unique_ptr is; + std::shared_ptr is; public: Token last{0, 0}; Token t{0, 0}; Token next{0, 0}; - std::unique_ptr scanner; + std::shared_ptr scanner; std::optional filename; bool isImplicitInclude; @@ -51,17 +51,17 @@ class MQT_CORE_EXPORT Parser { std::istream* in, std::optional debugFilename = std::nullopt, const bool implicitInclude = false) - : scanner(std::make_unique(in)), + : scanner(std::make_shared(in)), filename(std::move(debugFilename)), isImplicitInclude(implicitInclude) { scan(); } explicit ScannerState( - std::unique_ptr in, + std::shared_ptr in, std::optional debugFilename = std::nullopt, const bool implicitInclude = false) - : is(std::move(in)), scanner(std::make_unique(is.get())), + : is(std::move(in)), scanner(std::make_shared(is.get())), filename(std::move(debugFilename)), isImplicitInclude(implicitInclude) { scan(); @@ -120,7 +120,7 @@ class MQT_CORE_EXPORT Parser { scanner.emplace(is); scan(); if (implicitlyIncludeStdgates) { - scanner.emplace(std::make_unique(STDGATES), + scanner.emplace(std::make_shared(STDGATES), "stdgates.inc", true); scan(); }