diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-16 10:04:27 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-16 10:04:27 +0000 |
| commit | 45c9d37eb27d204a6202b33cb37e890af0171357 (patch) | |
| tree | dba23170b16053c5e1ec4bf78efc2a533cb94a4e /include/cps/Parser.h | |
| parent | 522742e9df7fc5ac596ce4aa53d41b31e4f6a030 (diff) | |
feat(control-flow): implement ordered CASE OF matching
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/Parser.h')
| -rw-r--r-- | include/cps/Parser.h | 10 |
1 files changed, 8 insertions, 2 deletions
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<unsigned> CaseBodyDepths; unsigned NumErrors = 0; unsigned BlockDepth = 0; // ParseBlock nesting; 1 = top level @@ -41,7 +44,10 @@ class Parser { std::unique_ptr<StmtAST> ParseStatement(); std::unique_ptr<StmtAST> ParseStatementImpl(); - std::vector<std::unique_ptr<StmtAST>> ParseBlock(std::initializer_list<int> Terminators); + std::vector<std::unique_ptr<StmtAST>> ParseBlock(std::initializer_list<int> Terminators, bool CaseBody = false); + bool isCaseLabel(); + bool atCaseBoundary(); + std::unique_ptr<StmtAST> ParseCaseStmt(); std::optional<std::vector<std::unique_ptr<ExprAST>>> ParseExprList(char CloseDelim, bool AllowEmpty); void syncToStatementStart(); std::unique_ptr<StmtAST> ParseIfStmt(); |
