aboutsummaryrefslogtreecommitdiff
path: root/include/cps
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 04:05:31 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 04:05:51 +0000
commite1fea0e3b49f3b9b3e8a317ceb1938d3d02bf0a0 (patch)
tree70042e0e6a70c18e6c305f7c8855e3b1243d748e /include/cps
parent0b763257ed1e230767171234971cc8f660d59087 (diff)
refactor(parser): share the FUNCTION and PROCEDURE body tail
ParseFunctionBody() scopes the prototype's pack parameters, parses the body up to ENDFUNCTION/ENDPROCEDURE, reports the same "expected ..." diagnostic and builds the FunctionDefAST for both declaration forms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps')
-rw-r--r--include/cps/Parser.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/cps/Parser.h b/include/cps/Parser.h
index fbccb3c..eff25a5 100644
--- a/include/cps/Parser.h
+++ b/include/cps/Parser.h
@@ -93,6 +93,8 @@ class Parser {
std::unique_ptr<FunctionDefAST> ParseFunction(const std::string &OwnerClass = {}, bool IsPublic = true, bool IsOverload = false);
std::unique_ptr<FunctionDefAST> ParseProcedure(const std::string &OwnerClass = {}, bool IsPublic = true, bool IsOverload = false);
+ std::unique_ptr<FunctionDefAST> ParseFunctionBody(
+ std::unique_ptr<PrototypeAST> Proto, int EndToken, const char *EndMessage, int Line);
std::unique_ptr<StmtAST> ParseExternDecl();
std::unique_ptr<StmtAST> ParseCallStmt();
std::unique_ptr<StmtAST> ParseReturnStmt();