コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public static string Format(SourceCode source, params SourceTransformation[] transformation)
        {
            SourceFormatter formatter = new SourceFormatter(source);

            return(formatter.format(transformation));
        }