Allowed Util::PrintLn to use T.LogStr()

This commit is contained in:
Pasha Bibko
2025-07-23 21:22:39 +01:00
parent 86a178b7d5
commit 004f859cc7
2 changed files with 24 additions and 1 deletions

View File

@@ -139,12 +139,30 @@ namespace LXC::Util
// Prints arguments to the console with a new-line character at the end //
template<typename... Args>
requires Internal::AllLogable<Args...>
requires Internal::AllLogable<Args...> && (sizeof...(Args) > 1)
inline void PrintLn(Args&&... args)
{
Internal::WriteImpl<Util::Color::DEFAULT, true>(std::cout, std::forward<Args>(args)...);
}
// Prints a new line within the console //
inline void PrintLn()
{
Internal::WriteImpl<Util::Color::DEFAULT, true>(std::cout);
}
// Prints argument to the console with a new line character at the end //
template<typename T>
requires Internal::HasLogStrFunc<T> || Internal::Logable<T>
inline void PrintLn(T&& arg)
{
if constexpr (Internal::HasLogStrFunc<T>)
Internal::WriteImpl<Util::Color::DEFAULT, true>(std::cout, arg.LogStr());
else
Internal::WriteImpl<Util::Color::DEFAULT, true>(std::cout, arg);
}
// Logs all the arguments to the file (automatically flushes) //
template<typename... Args>
requires Internal::AllLogable<Args...> && (sizeof...(Args) > 1)

View File

@@ -6,6 +6,11 @@ namespace LXC::Parser
{
Util::ReturnVal<std::vector<FunctionAST>, ParserError> TurnTokensIntoAST(const Lexer::LexerOutput& input)
{
for (const auto& token : input)
{
Util::PrintLn(token);
}
return Util::FunctionFail<ParserError>();
}
}