Files
LXC/parser/inc/LX_Parser.h
Pasha Bibko d604de28fd Removed unnecessary code
Also made console be cleared when a build process is done to make it look cleaner.
2025-08-20 20:57:04 +01:00

48 lines
1.2 KiB
C++

#pragma once
#include <Util.h>
#include <NodeTypes.h>
#include <Lexer.h>
namespace PashaBibko::LXC::Parser
{
struct ParserError {};
struct FunctionAST
{
FunctionAST() :
name{}, contents{}, funcParams{}
{}
FunctionAST(const FunctionAST& other) = delete;
FunctionAST(FunctionAST&& other) noexcept :
name(std::move(other.name)), contents(std::move(other.contents)), funcParams(std::move(other.funcParams))
{}
std::string name;
std::vector<std::pair<std::string, std::string>> funcParams;
AST::SyntaxBranch contents;
std::string LogStr() const
{
std::ostringstream os;
os << name << " (";
for (size_t i = 0; i < funcParams.size(); i++)
{
os << funcParams[i].first << ' ' << funcParams[i].second;
if (i != funcParams.size() - 1)
os << ", ";
}
os << ") [" << contents.size() << ']';
return os.str();
}
};
Util::ReturnVal<std::vector<FunctionAST>, ParserError> TurnTokensIntoAST(const Lexer::LexerOutput& input);
}