private void FormatEntry(Span sp, SourceMap sourceMap, string additional) { Console.Write($"{Color.NicePurple.ToS()}{FormatLocation(sp, sourceMap)}{Color.Reset.ToS()}: "); Console.WriteLine($"{Color.Bold.ToS()}{Color.Red.ToS()}{additional}{Color.Reset.ToS()}"); var(_, a, b, c, d) = GetHumanPos(sp, sourceMap); Console.Write(FormatLines(sourceMap.LookupSource(sp.Sid).Split("\n"), a, b, c, d)); }
private (string, int, int, int, int) GetHumanPos(Span sp, SourceMap sourceMap) { string filename = sourceMap.LookupFilename(sp.Sid); string file = sourceMap.LookupSource(sp.Sid); var(linenoS, colnoS) = Span.LineCol(sp.S, file); var(linenoE, colnoE) = Span.LineCol(sp.E, file); return(filename, linenoS, colnoS, linenoE, colnoE); }