From 10a2b64ac482ec01bc21796625d8313580b0f544 Mon Sep 17 00:00:00 2001 From: dimgigov Date: Wed, 10 Jun 2026 20:04:31 +0300 Subject: [PATCH] feat(diag): print parser diagnostics in Parser_Parse --- src/parser.bux | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/parser.bux b/src/parser.bux index db1c3a5..d2c9b70 100644 --- a/src/parser.bux +++ b/src/parser.bux @@ -1773,6 +1773,35 @@ func Parser_Parse(tokens: *LexToken, tokenCount: int) -> *Module { } } + /* Print parser diagnostics */ + if p.diagCount > 0 { + var di: int = 0; + while di < p.diagCount { + let d: ParserDiag = p.diags[di]; + Print("error: "); + PrintLine(d.message); + Print(" --> :"); + PrintInt(d.line as int64); + Print(":"); + PrintInt(d.column as int64); + PrintLine(""); + Print(" |"); + PrintLine(""); + Print(" "); + PrintInt(d.line as int64); + Print(" | "); + PrintLine(""); + Print(" | "); + var sp: uint32 = 0; + while sp < d.column - 1 && sp < 120 { + Print(" "); + sp = sp + 1; + } + PrintLine("^"); + di = di + 1; + } + } + return mod; }