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 --- lib/Parser/ParserExpression.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Parser/ParserExpression.cc') diff --git a/lib/Parser/ParserExpression.cc b/lib/Parser/ParserExpression.cc index 3e2665f..d32c407 100644 --- a/lib/Parser/ParserExpression.cc +++ b/lib/Parser/ParserExpression.cc @@ -5,6 +5,7 @@ using namespace cps; int Parser::GetTokPrecedence() { + if (atCaseBoundary()) return -1; if (BinopPrecedence.find(CurTok) == BinopPrecedence.end()) return -1; int TokPrec = BinopPrecedence[CurTok]; if (TokPrec <= 0) return -1; @@ -28,7 +29,7 @@ std::unique_ptr Parser::ParseIdentifierExpr() { int Line = Lex.getLine(); getNextToken(); - if (CurTok == '(') { + if (CurTok == '(' && !atCaseBoundary()) { getNextToken(); auto Args = ParseExprList(')', true); if (!Args) return nullptr; @@ -54,6 +55,7 @@ std::unique_ptr Parser::ParseIdentifierExpr() { // Postfix accessor chain after an identifier: '[' exprs ']' | '.' IDENT | '^' bool Parser::ParseDesignatorSuffix(std::vector &Out) { while (true) { + if (atCaseBoundary()) return true; if (CurTok == '[') { getNextToken(); auto Indices = ParseExprList(']', false); -- cgit v1.3.1-4-g156e