diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-21 05:43:35 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-21 05:43:35 +0000 |
| commit | dd5bbae055fd34ce2e12ef63f8a261c6b15dc83e (patch) | |
| tree | 757e367daacf92c50148eb42d7bda97ba33ed3fb /include/cps/Parser.h | |
| parent | c682f983b0dce3acba76d1f08719a26b9c52c5ec (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.h | 7 |
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); |
