package grace
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
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.json_conv/grace_json_conv.ml.html
Source file grace_json_conv.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 56open Grace open Grace_std let json_of_byte_index ~in_ (idx : Byte_index.t) = let open Grace_source_reader.Line in let line = of_byte_index in_ idx in let col = column_offset ~in_ line idx in let line_json = `Int ((line.idx :> int) + 1) in let column_json = `Int col in `Assoc [ "line", line_json; "column", column_json ] ;; let json_of_range (r : Range.t) : Yojson.Basic.t = let sd = Grace_source_reader.open_source (Range.source r) in let vals = [ "start", json_of_byte_index ~in_:sd (Range.start r) ; "end", json_of_byte_index ~in_:sd (Range.stop r) ] in match Source.name (Range.source r) with | Some name -> `Assoc (("source", `String name) :: vals) | None -> `Assoc vals ;; let json_of_message (message : Diagnostic.Message.t) : Yojson.Basic.t = `String (Diagnostic.Message.to_string message) ;; let json_of_label ({ range; priority; message } : Diagnostic.Label.t) : Yojson.Basic.t = `Assoc Diagnostic. [ "range", json_of_range range ; "priority", `String (Priority.to_string priority) ; "message", json_of_message message ] ;; let json_of_diagnostic ?code_to_string ({ severity; message; notes; labels; code } : 'a Diagnostic.t) : Yojson.Basic.t = Grace_source_reader.with_reader @@ fun () -> let vals = Diagnostic. [ "severity", `String (Severity.to_string severity) ; "message", json_of_message message ; "notes", `List (List.map notes ~f:json_of_message) ; "labels", `List (List.map labels ~f:json_of_label) ] in match code_to_string, code with | Some f, Some c -> `Assoc (("error_code", `String (f c)) :: vals) | _ -> `Assoc vals ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>