/// <summary> /// Initializes a new instance of the <see cref="ReportMessage"/> class. /// </summary> /// <param name="level">The type.</param> /// <param name="code">The error code.</param> /// <param name="text">The text.</param> /// <param name="span">The span.</param> public ReportMessage(ReportMessageLevel level, string code, string text, SourceSpan span) { this.Level = level; this.Code = code; this.Text = text; this.Span = span; }
private static void HandleMessages(ParseTree parseTree, string file, ParsingResult result) { foreach (var parserMessage in parseTree.ParserMessages) { var level = new ReportMessageLevel(); switch (parserMessage.Level) { case ParserErrorLevel.Info: level = ReportMessageLevel.Info; break; case ParserErrorLevel.Error: level = ReportMessageLevel.Error; break; case ParserErrorLevel.Warning: level = ReportMessageLevel.Warning; break; } result.Messages.Add(new ReportMessage(level, "", parserMessage.Message, new Ast.SourceSpan(SpanConverter.Convert(parserMessage.Location), 0))); if (parserMessage.Level != ParserErrorLevel.Info) { result.HasErrors = true; } } }
/// <summary> /// Adds the message. /// </summary> /// <param name="level">The type.</param> /// <param name="message">The message.</param> /// <param name="span">The span.</param> /// <param name="parameters">The parameters.</param> protected void AddMessage(ReportMessageLevel level, MessageCode message, SourceSpan span, params object[] parameters) { if (level == ReportMessageLevel.Error) { this.HasErrors = true; } this.Messages.Add(new ReportMessage(level, message.Code, string.Format(message.Text, parameters), span)); }
/// <summary> /// Adds the message. /// </summary> /// <param name="level">The type.</param> /// <param name="message">The message.</param> /// <param name="span">The span.</param> protected void AddMessage(ReportMessageLevel level, MessageCode message, SourceSpan span) { if (level == ReportMessageLevel.Error) { this.HasErrors = true; } this.Messages.Add(new ReportMessage(level, message.Code, message.Text, span)); }
/// <summary> /// Dumps the messages. /// </summary> /// <param name="level">The level.</param> /// <param name="writer">The writer.</param> public void DumpMessages(ReportMessageLevel level, TextWriter writer) { foreach (var reportMessage in this.Messages) { if (reportMessage.Level >= level) { writer.WriteLine(reportMessage); } } }
private static string ConvertToStringLevel(ReportMessageLevel level) { return(level.ToString().ToLowerInvariant()); }
private static string ConvertToStringLevel(ReportMessageLevel level) { return level.ToString().ToLowerInvariant(); }
/// <summary> /// Adds the message. /// </summary> /// <param name="level">The type.</param> /// <param name="message">The message.</param> /// <param name="span">The span.</param> /// <param name="parameters">The parameters.</param> protected void AddMessage(ReportMessageLevel level, MessageCode message, SourceSpan span, params object[] parameters) { if (level == ReportMessageLevel.Error) this.HasErrors = true; this.Messages.Add(new ReportMessage(level, message.Code, string.Format(message.Text, parameters), span)); }
/// <summary> /// Adds the message. /// </summary> /// <param name="level">The type.</param> /// <param name="message">The message.</param> /// <param name="span">The span.</param> protected void AddMessage(ReportMessageLevel level, MessageCode message, SourceSpan span) { if (level == ReportMessageLevel.Error) this.HasErrors = true; this.Messages.Add(new ReportMessage(level, message.Code, message.Text, span)); }
public ReportMessage(string message, ReportMessageLevel level) { Message = message; Level = level; }