From 45c9d37eb27d204a6202b33cb37e890af0171357 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 10:04:27 +0000 Subject: feat(control-flow): implement ordered CASE OF matching Co-Authored-By: Claude Fable 5.1 --- include/cps/AST.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/cps/AST.h') diff --git a/include/cps/AST.h b/include/cps/AST.h index e3c6bc5..87c9341 100644 --- a/include/cps/AST.h +++ b/include/cps/AST.h @@ -168,6 +168,22 @@ public: const std::vector> &getExprs() const { return Exprs; } }; +struct CaseBranch { + std::unique_ptr Lower, Upper; // Null Lower denotes OTHERWISE. + std::vector> Body; + int Line; +}; + +class CaseStmtAST : public StmtAST { + std::string Selector; + std::vector Branches; +public: + CaseStmtAST(std::string Selector, std::vector Branches) + : Selector(std::move(Selector)), Branches(std::move(Branches)) {} + const std::string &getSelector() const { return Selector; } + const std::vector &getBranches() const { return Branches; } +}; + class IfStmtAST : public StmtAST { std::unique_ptr Cond; std::vector> ThenStmts; -- cgit v1.3.1-4-g156e