示例#1
0
文件: Error.cs 项目: MonliH/zircon
 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));
 }
示例#2
0
文件: Error.cs 项目: MonliH/zircon
        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);
        }