diff --git a/src/Lexer.cpp b/src/Lexer.cpp index fe4c84b..47ccd98 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -60,12 +60,12 @@ std::string Lexer::recalculate_current_line(const std::string& text) return final_str; } -std::shared_ptr Lexer::make_lexer(const std::string& fname) +std::unique_ptr Lexer::make_lexer(const std::string& fname) { - return std::shared_ptr(new Lexer(fname)); // not using make_shared because the constructor is private + return std::unique_ptr(new Lexer(fname)); // not using make_shared because the constructor is private } -void Lexer::assign_parent_location(std::shared_ptr& lexer, const std::shared_ptr& loc) +void Lexer::assign_parent_location(std::unique_ptr& lexer, const std::shared_ptr& loc) { lexer->loc.parent = loc; } diff --git a/src/Lexer.h b/src/Lexer.h index 0493cb4..0994ddd 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -46,8 +46,8 @@ class Lexer TokenStream lex(const std::string& text); /* Create a new Lexer and return a pointer to it. */ - static std::shared_ptr make_lexer(const std::string& fname); + static std::unique_ptr make_lexer(const std::string& fname); /* If the Lexer is lexing an impòrted file, give it the location in the parent file at which it was imported. */ - static void assign_parent_location(std::shared_ptr& lexer, const std::shared_ptr& loc); + static void assign_parent_location(std::unique_ptr& lexer, const std::shared_ptr& loc); };