public static string HighlightContext(this SourceCode source, SourceContext context) { string highlighted = SourceFormatter.Format(source, new SourceTransformation(context, n => string.IsNullOrWhiteSpace(n) ? n : "_")); string[] lines = highlighted.Split(Environment.NewLine); return(SourcePrinter.WithLineNumbers(lines)); }
public static string HighlightLocation(this SourceCode source, SourceLocation location) { string highlighted = SourceFormatter.Format(source, new SourceTransformation(new SourceContext(location.Location, 1), n => $"|{n}")); string[] lines = highlighted.Split(Environment.NewLine); return(SourcePrinter.WithLineNumbers(lines)); }
public static string Format(SourceCode source, params SourceTransformation[] transformation) { SourceFormatter formatter = new SourceFormatter(source); return(formatter.format(transformation)); }