private void VisualizeMessage(ReportItem item) { Console.WriteLine(); foreach (TokenInfo token in item.SourceLine) { if (token.Is(Token.EOL)) { Console.WriteLine(); } else { Console.SetCursorPosition(token.GetSourceLocation().Col, Console.CursorTop++); if (colorize) { if (BasicParser.Helpers.IsReservedWord(token)) Console.ForegroundColor = colorScheme.ForegorundColor_Keyword; else Console.ForegroundColor = colorScheme.ForegroundColor; //ConsoleColor.Gray; } Console.Write("{0} ", token.Value); } } Console.SetCursorPosition(item.SourceSpan.Start.Col, Console.CursorTop + 1); if (colorize) Console.ForegroundColor = colorScheme.ForegroundColor_ErrorUnderline; for (int i = item.SourceSpan.Start.Col; i < item.SourceSpan.End.Col; i++) { Console.Write('~'); } Console.WriteLine(); if (colorize) { Console.ForegroundColor = colorScheme.ForegroundColor; // ConsoleColor.Gray; } }
private static void PrintMessage(ReportItem item) { Console.WriteLine(string.Format("{0}({1}) : error {2}: {3}", item.SourceFile, item.SourceSpan.Start.Ln, item.MessageDescriptor.Code, item.Message)); }
private void PrintReportItem(ReportItem item) { PrintMessage(item); if (item.MessageDescriptor.IsVisualizable && visualize) { VisualizeMessage(item); } }