Add some helpers to String_with_loc
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
54ff98b36d
commit
8ef6af2675
|
@ -208,6 +208,15 @@ module Var = struct
|
||||||
match destruct t with
|
match destruct t with
|
||||||
| Single s -> s
|
| Single s -> s
|
||||||
| Pair (k, v) -> k ^ ":" ^ v
|
| Pair (k, v) -> k ^ ":" ^ v
|
||||||
|
|
||||||
|
let to_string = string_of_var
|
||||||
|
|
||||||
|
let fail v ~f = Loc.fail (loc v) "%s" (f (to_string v))
|
||||||
|
|
||||||
|
let sexp_of_t t = Sexp.atom (to_string t)
|
||||||
|
|
||||||
|
let rename t ~new_name =
|
||||||
|
{ t with name = new_name }
|
||||||
end
|
end
|
||||||
|
|
||||||
let partial_expand
|
let partial_expand
|
||||||
|
|
|
@ -49,6 +49,8 @@ end
|
||||||
module Var : sig
|
module Var : sig
|
||||||
type t
|
type t
|
||||||
|
|
||||||
|
val sexp_of_t : t -> Sexp.t
|
||||||
|
|
||||||
val loc : t -> Loc.t
|
val loc : t -> Loc.t
|
||||||
val full_name : t -> string
|
val full_name : t -> string
|
||||||
|
|
||||||
|
@ -57,6 +59,12 @@ module Var : sig
|
||||||
| Pair of string * string
|
| Pair of string * string
|
||||||
|
|
||||||
val destruct : t -> kind
|
val destruct : t -> kind
|
||||||
|
|
||||||
|
val fail : t -> f:(string -> string) -> _
|
||||||
|
|
||||||
|
val to_string : t -> string
|
||||||
|
|
||||||
|
val rename : t -> new_name:string -> t
|
||||||
end
|
end
|
||||||
|
|
||||||
val expand
|
val expand
|
||||||
|
|
Loading…
Reference in New Issue