From 59a2bb6acb975d820ab29be63a6f909d6e6ef40f Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 09:09:54 +0000 Subject: feat(parser): parse INCLUDE and GLOBAL blocks Co-Authored-By: Claude Opus 5.5 --- include/cps/AST.h | 15 +++++++++++++++ include/cps/Lexer.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'include') 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> Body; +public: + explicit GlobalBlockAST(std::vector> Body) + : Body(std::move(Body)) {} + const auto &getBody() const { return Body; } +}; + class TryStmtAST : public StmtAST { std::vector> 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, -- cgit v1.3.1-4-g156e