aboutsummaryrefslogtreecommitdiff
path: root/include/cps
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 09:09:54 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 09:09:54 +0000
commit59a2bb6acb975d820ab29be63a6f909d6e6ef40f (patch)
treeac87916075e9e5a9f166b14fea0b39864d801166 /include/cps
parentdc645a36aaade7087ade574cefe69ce7bb29753e (diff)
feat(parser): parse INCLUDE and GLOBAL blocks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps')
-rw-r--r--include/cps/AST.h15
-rw-r--r--include/cps/Lexer.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/include/cps/AST.h b/include/cps/AST.h
index f20b106..8c8c3be 100644
--- a/include/cps/AST.h
+++ b/include/cps/AST.h
@@ -100,6 +100,21 @@ public:
virtual ~StmtAST() = default;
};
+class IncludeStmtAST : public StmtAST {
+ std::string Path;
+public:
+ explicit IncludeStmtAST(std::string Path) : Path(std::move(Path)) {}
+ const std::string &getPath() const { return Path; }
+};
+
+class GlobalBlockAST : public StmtAST {
+ std::vector<std::unique_ptr<StmtAST>> Body;
+public:
+ explicit GlobalBlockAST(std::vector<std::unique_ptr<StmtAST>> Body)
+ : Body(std::move(Body)) {}
+ const auto &getBody() const { return Body; }
+};
+
class TryStmtAST : public StmtAST {
std::vector<std::unique_ptr<StmtAST>> Body, CatchBody;
public:
diff --git a/include/cps/Lexer.h b/include/cps/Lexer.h
index b465591..957ca48 100644
--- a/include/cps/Lexer.h
+++ b/include/cps/Lexer.h
@@ -101,6 +101,8 @@ enum Token {
tok_c_double = -612,
tok_new = -613, tok_delete = -614,
+ tok_include = -650, tok_global = -651, tok_endglobal = -652,
+
tok_try = -700,
tok_catch = -701,
tok_endtry = -702,