File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,12 @@ let parse_lx (lexbuf: Lexing.lexbuf) : Locs.t =
148148 Mustache_lexer. (handle_standalone mustache lexbuf)
149149
150150let of_string s = parse_lx (Lexing. from_string s)
151+ let of_channel c = parse_lx (Lexing. from_channel c)
152+ let of_file f =
153+ let c = open_in f in
154+ let ret = of_channel c in
155+ close_in c;
156+ ret
151157
152158(* Utility module, that helps looking up values in the json data during the
153159 rendering phase. *)
@@ -209,6 +215,8 @@ module Without_locations = struct
209215
210216 let parse_lx lexbuf = erase_locs (parse_lx lexbuf)
211217 let of_string s = erase_locs (of_string s)
218+ let of_channel c = erase_locs (of_channel c)
219+ let of_file f = erase_locs (of_file f)
212220
213221 let pp = pp
214222 let to_formatter = pp
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ and partial =
4646(* * Read *)
4747val parse_lx : Lexing .lexbuf -> t
4848val of_string : string -> t
49+ val of_channel : in_channel -> t
50+ val of_file : string -> t
4951
5052(* * [pp fmt template] print a template as raw mustache to
5153 the formatter [fmt]. *)
You can’t perform that action at this time.
0 commit comments