Skip to content
Snippets Groups Projects
Commit 25ac0835 authored by David Bühler's avatar David Bühler
Browse files

[server] Kernel_ast: adds a data for a pair kf * localizable.

This is the type for an ivette location.
parent 2a23f673
No related branches found
No related tags found
No related merge requests found
...@@ -240,6 +240,32 @@ struct ...@@ -240,6 +240,32 @@ struct
with Not_found -> Data.failure "Undefined function '%s'" key with Not_found -> Data.failure "Undefined function '%s'" key
end end
module KfMarker = struct
type record
let record : record Record.signature = Record.signature ()
let fct = Record.field record ~name:"function"
~descr:(Md.plain "Function") (module Kf)
let marker = Record.field record ~name:"marker"
~descr:(Md.plain "Marker") (module Marker)
let data =
Record.publish ~package ~name:"location"
~descr:(Md.plain "Location: function and marker") record
module R : Record.S with type r = record = (val data)
type t = kernel_function * Printer_tag.localizable
let jtype = R.jtype
let to_json (kf, loc) =
R.default |>
R.set fct kf |>
R.set marker loc |>
R.to_json
let of_json json =
let r = R.of_json json in
R.get fct r, R.get marker r
end
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
(* --- Functions --- *) (* --- Functions --- *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
...@@ -47,6 +47,8 @@ sig ...@@ -47,6 +47,8 @@ sig
val lookup : string -> t (** Get back the localizable, if any. *) val lookup : string -> t (** Get back the localizable, if any. *)
end end
module KfMarker : Data.S with type t = kernel_function * Printer_tag.localizable
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
(** Ast Printer *) (** Ast Printer *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment