From dd5bbae055fd34ce2e12ef63f8a261c6b15dc83e Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 21 Oct 2026 05:43:35 +0000 Subject: feat(parser): parse TEMPLATE declarations, template ids and parameter packs Co-Authored-By: Claude Opus 5.5 --- include/cps/FunctionAST.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include/cps/FunctionAST.h') diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h index 90ef5c4..9188015 100644 --- a/include/cps/FunctionAST.h +++ b/include/cps/FunctionAST.h @@ -23,6 +23,7 @@ struct ParamDecl { int Rank = 0; // 0 = scalar std::vector> DeclaredBounds; int Line = 0; + bool IsPack = false; }; class PrototypeAST { @@ -87,25 +88,31 @@ public: class CallExprAST : public ExprAST { std::string Callee; std::vector> Args; + std::vector TemplateArgs; public: - CallExprAST(const std::string &Callee, std::vector> Args, int Line) - : ExprAST(Line), Callee(Callee), Args(std::move(Args)) {} + CallExprAST(const std::string &Callee, std::vector> Args, int Line, + std::vector TemplateArgs = {}) + : ExprAST(Line), Callee(Callee), Args(std::move(Args)), TemplateArgs(std::move(TemplateArgs)) {} const std::string &getCallee() const { return Callee; } const std::vector> &getArgs() const { return Args; } + const std::vector &getTemplateArgs() const { return TemplateArgs; } }; class CallStmtAST : public StmtAST { std::string Callee; std::vector> Args; + std::vector TemplateArgs; public: - CallStmtAST(const std::string &Callee, std::vector> Args, int Line) - : StmtAST(Line), Callee(Callee), Args(std::move(Args)) {} + CallStmtAST(const std::string &Callee, std::vector> Args, int Line, + std::vector TemplateArgs = {}) + : StmtAST(Line), Callee(Callee), Args(std::move(Args)), TemplateArgs(std::move(TemplateArgs)) {} const std::string &getCallee() const { return Callee; } const std::vector> &getArgs() const { return Args; } + const std::vector &getTemplateArgs() const { return TemplateArgs; } }; -- cgit v1.3.1-4-g156e