jtr/DevDisciples.Parsing/Report.cs
2024-09-15 17:23:27 +02:00

20 lines
529 B
C#

namespace DevDisciples.Parsing;
public static class Report
{
public static Exception Error(ISourceLocation token, string message)
{
return new(FormatMessage(token, message));
}
public static void Halt(ISourceLocation token, string message)
{
throw new(FormatMessage(token, message));
}
public static string FormatMessage(ISourceLocation token, string msg)
{
return $"{token.File}\n\t[line: {token.Line}, column: {token.Column}] {msg}";
}
}