19 lines
577 B
C#
19 lines
577 B
C#
namespace DevDisciples.Parsing;
|
|
|
|
public static class Report
|
|
{
|
|
public static SyntaxException SyntaxException(ISourceLocation token, string message)
|
|
{
|
|
return new SyntaxException(FormatMessage(token, message));
|
|
}
|
|
|
|
public static void SyntaxHalt(ISourceLocation token, string message)
|
|
{
|
|
throw new SyntaxException(FormatMessage(token, message));
|
|
}
|
|
|
|
public static string FormatMessage(ISourceLocation token, string msg)
|
|
{
|
|
return $"{token.File}\n\t[line: {token.Line}, column: {token.Column}] {msg}";
|
|
}
|
|
} |