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; }