diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-13 08:47:52 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-13 08:47:52 +0000 |
| commit | 5d5c14920a9aa3397d4b479c22e37392be5557f4 (patch) | |
| tree | 31eec35c4ef9b7afc310fb624ce1abdb43e3e497 /lib/Parser/Parser.cc | |
| parent | 58e2cfe505ba9942524f06bb1b1419e6c579efad (diff) | |
feat: support comma-separated OUTPUT expressions
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'lib/Parser/Parser.cc')
| -rw-r--r-- | lib/Parser/Parser.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc index 260472c..25fc342 100644 --- a/lib/Parser/Parser.cc +++ b/lib/Parser/Parser.cc @@ -555,9 +555,15 @@ std::unique_ptr<StmtAST> Parser::ParseStatementImpl() { } else if (CurTok == tok_output) { getNextToken(); - auto Expr = ParseExpression(); - if (!Expr) return nullptr; - return std::make_unique<OutputStmtAST>(std::move(Expr)); + std::vector<std::unique_ptr<ExprAST>> Exprs; + while (true) { + auto Expr = ParseExpression(); + if (!Expr) return nullptr; + Exprs.push_back(std::move(Expr)); + if (CurTok != ',') break; + getNextToken(); + } + return std::make_unique<OutputStmtAST>(std::move(Exprs)); } else if (CurTok == tok_if) { return ParseIfStmt(); |
