package grace

  1. Overview
  2. Docs
A fancy diagnostics library that allows your compilers to exit with grace

Install

dune-project
 Dependency

Authors

Maintainers

Sources

grace-0.4.1.tbz
sha256=d49754224206de44855590848b3a5a6cc1d5c46cf99a4e5810ca3041d436a28e
sha512=2984b5a6284bf8bbd05419cf850c15c34bc19c19f0c8928b83cc1be1c0bfc84aafef6d992e7435c2f48ba361a6f3aab679abd02f0e6472361c8cec7d497bc405

doc/src/grace.ansi_renderer/grace_ansi_renderer.ml.html

Source file grace_ansi_renderer.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
open! Import
module Config = Config

let default_code_to_string _code = "E????"

let of_snippet_renderer
      snippet_of_diagnostic
      f
      ?(config = Config.default)
      ?(code_to_string = default_code_to_string)
      x
      diagnostic
  =
  let snippet =
    Source_reader.with_reader @@ fun () -> snippet_of_diagnostic diagnostic ~config
  in
  f ~config ~code_to_string x snippet
;;

let pp_diagnostic ?config ?code_to_string ppf diagnostic =
  of_snippet_renderer
    Snippet.of_diagnostic
    Snippet_renderer.pp_snippet
    ?config
    ?code_to_string
    ppf
    diagnostic
;;

let pp_compact_diagnostic ?config ?code_to_string ppf diagnostic =
  of_snippet_renderer
    Snippet.compact_of_diagnostic
    Snippet_renderer.pp_snippet
    ?config
    ?code_to_string
    ppf
    diagnostic
;;

let output_diagnostic ?config ?code_to_string oc diagnostic =
  of_snippet_renderer
    Snippet.of_diagnostic
    Snippet_renderer.output_snippet
    ?config
    ?code_to_string
    oc
    diagnostic
;;

let output_compact_diagnostic ?config ?code_to_string oc diagnostic =
  of_snippet_renderer
    Snippet.compact_of_diagnostic
    Snippet_renderer.output_snippet
    ?config
    ?code_to_string
    oc
    diagnostic
;;

let of_snippet_renderer
      snippet_of_diagnostic
      f
      ?(config = Config.default)
      ?(code_to_string = default_code_to_string)
      diagnostic
  =
  let snippet =
    Source_reader.with_reader @@ fun () -> snippet_of_diagnostic diagnostic ~config
  in
  f ~config ~code_to_string snippet
;;

let pr_diagnostic ?config ?code_to_string diagnostic =
  of_snippet_renderer
    Snippet.of_diagnostic
    Snippet_renderer.pr_snippet
    ?config
    ?code_to_string
    diagnostic
;;

let pr_compact_diagnostic ?config ?code_to_string diagnostic =
  of_snippet_renderer
    Snippet.compact_of_diagnostic
    Snippet_renderer.pr_snippet
    ?config
    ?code_to_string
    diagnostic
;;

let epr_diagnostic ?config ?code_to_string diagnostic =
  of_snippet_renderer
    Snippet.of_diagnostic
    Snippet_renderer.epr_snippet
    ?config
    ?code_to_string
    diagnostic
;;

let epr_compact_diagnostic ?config ?code_to_string diagnostic =
  of_snippet_renderer
    Snippet.compact_of_diagnostic
    Snippet_renderer.epr_snippet
    ?config
    ?code_to_string
    diagnostic
;;