Add context and all supported versions when an syntax id is unset
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
166dd06886
commit
f130b62648
|
@ -40,6 +40,10 @@ end
|
||||||
module Supported_versions = struct
|
module Supported_versions = struct
|
||||||
type t = int Int.Map.t
|
type t = int Int.Map.t
|
||||||
|
|
||||||
|
let sexp_of_t (t : t) =
|
||||||
|
let open Sexp.To_sexp in
|
||||||
|
(list (pair int int)) (Int.Map.to_list t)
|
||||||
|
|
||||||
let make l : t =
|
let make l : t =
|
||||||
match
|
match
|
||||||
List.map l ~f:(fun (major, minor) -> (major, minor))
|
List.map l ~f:(fun (major, minor) -> (major, minor))
|
||||||
|
@ -125,11 +129,15 @@ let set t ver parser =
|
||||||
set t.key ver parser
|
set t.key ver parser
|
||||||
|
|
||||||
let get_exn t =
|
let get_exn t =
|
||||||
get t.key >>| function
|
get t.key >>= function
|
||||||
| Some x -> x
|
| Some x -> return x
|
||||||
| None ->
|
| None ->
|
||||||
|
get_all >>| fun context ->
|
||||||
Exn.code_error "Syntax identifier is unset"
|
Exn.code_error "Syntax identifier is unset"
|
||||||
[ "name", Sexp.To_sexp.string t.name ]
|
[ "name", Sexp.To_sexp.string t.name
|
||||||
|
; "supported_versions", Supported_versions.sexp_of_t t.supported_versions
|
||||||
|
; "context", Univ_map.sexp_of_t context
|
||||||
|
]
|
||||||
|
|
||||||
let desc () =
|
let desc () =
|
||||||
kind >>| fun kind ->
|
kind >>| fun kind ->
|
||||||
|
|
Loading…
Reference in New Issue