Updated function signatures

This commit is contained in:
Pasha Bibko
2025-08-04 13:16:08 +01:00
parent 5bb9f2c28a
commit a77d5bd129
7 changed files with 83 additions and 66 deletions

View File

@@ -12,15 +12,33 @@ namespace LXC::Parser
struct FunctionAST
{
FunctionAST() :
name{}, contents{}
name{}, contents{}, funcParams{}
{}
FunctionAST(FunctionAST&& other) noexcept :
name{}, contents{}
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 << ")";
return os.str();
}
};
Util::ReturnVal<std::vector<FunctionAST>, ParserError> TurnTokensIntoAST(const Lexer::LexerOutput& input);