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/Parser.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/cps/Parser.h') diff --git a/include/cps/Parser.h b/include/cps/Parser.h index 5713587..921480d 100644 --- a/include/cps/Parser.h +++ b/include/cps/Parser.h @@ -16,7 +16,10 @@ namespace cps { class Parser { Lexer &Lex; - int CurTok; + int CurTok = tok_eof; + bool StartsLine = true; + bool ParsingCaseLabel = false; + std::vector CaseBodyDepths; unsigned NumErrors = 0; unsigned BlockDepth = 0; // ParseBlock nesting; 1 = top level @@ -41,7 +44,10 @@ class Parser { std::unique_ptr ParseStatement(); std::unique_ptr ParseStatementImpl(); - std::vector> ParseBlock(std::initializer_list Terminators); + std::vector> ParseBlock(std::initializer_list Terminators, bool CaseBody = false); + bool isCaseLabel(); + bool atCaseBoundary(); + std::unique_ptr ParseCaseStmt(); std::optional>> ParseExprList(char CloseDelim, bool AllowEmpty); void syncToStatementStart(); std::unique_ptr ParseIfStmt(); -- cgit v1.3.1-4-g156e