This repository has been archived on 2023-09-10. You can view files and clone it, but cannot push or open issues/pull-requests.
joko/lib/Factory.cpp

27 lines
494 B
C++
Raw Normal View History

2023-09-09 13:09:43 +00:00
#include "Factory.hpp"
namespace jk
{
/*explicit*/ Factory::Factory(Logger& logger, std::filesystem::path path)
: m_logger { logger }
, m_path { path }
{
}
/*virtual*/ Factory::~Factory()
{
}
std::shared_ptr<Lexer> Factory::make_lexer()
{
Loc loc {m_path, 1, 0};
return std::make_shared<Lexer>(m_logger, loc);
}
std::shared_ptr<Parser> Factory::make_parser()
{
auto lexer = make_lexer();
return std::make_shared<Parser>(m_logger, lexer);
}
}