aboutsummaryrefslogtreecommitdiff
path: root/include/cps/Parser.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-21 05:43:35 +0000
committer_ov4 <ov4@ov4.org>2026-10-21 05:43:35 +0000
commitdd5bbae055fd34ce2e12ef63f8a261c6b15dc83e (patch)
tree757e367daacf92c50148eb42d7bda97ba33ed3fb /include/cps/Parser.h
parentc682f983b0dce3acba76d1f08719a26b9c52c5ec (diff)
feat(parser): parse TEMPLATE declarations, template ids and parameter packs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/Parser.h')
-rw-r--r--include/cps/Parser.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/cps/Parser.h b/include/cps/Parser.h
index eedc3f8..f2c0868 100644
--- a/include/cps/Parser.h
+++ b/include/cps/Parser.h
@@ -4,6 +4,7 @@
#include "cps/AST.h"
#include "cps/TypeAST.h"
#include "cps/FunctionAST.h"
+#include "cps/TemplateAST.h"
#include <cstdint>
#include <vector>
#include <initializer_list>
@@ -23,6 +24,8 @@ class Parser {
std::vector<unsigned> CaseBodyDepths;
unsigned NumErrors = 0;
unsigned BlockDepth = 0; // ParseBlock nesting; 1 = top level
+ std::vector<TemplateParam> CurrentTemplate;
+ IdentifierSet PackNames;
std::map<int, int> BinopPrecedence;
IdentifierSet TypeNames = {
@@ -49,6 +52,9 @@ class Parser {
std::unique_ptr<MemberCallExprAST> ParseMemberCall(
const std::string &Name, std::vector<DesignatorAccess> Accesses, int Line);
std::string ParseTypeName(bool AllowVoid = false);
+ std::optional<std::vector<std::string>> ParseTemplateArgs();
+ bool isTemplateCall();
+ bool isTemplatePack(const std::string &Name) const;
std::unique_ptr<StmtAST> ParseStatement();
std::unique_ptr<StmtAST> ParseStatementImpl();
@@ -70,6 +76,7 @@ class Parser {
bool ParseDesignatorSuffix(std::vector<DesignatorAccess> &Out);
std::unique_ptr<StmtAST> ParseTypeDecl();
+ std::unique_ptr<StmtAST> ParseTemplateDecl();
std::optional<std::vector<RecordFieldDecl>> ParseRecordBody(
const std::string &Name, int Line, int EndToken,
std::vector<std::unique_ptr<FunctionDefAST>> *Methods = nullptr);