dune/src/loc.ml

18 lines
324 B
OCaml
Raw Normal View History

2016-11-03 16:44:09 +00:00
type t =
{ start : Lexing.position
; stop : Lexing.position
}
2016-11-13 11:13:47 +00:00
let of_lexbuf lb =
{ start = Lexing.lexeme_start lb
; stop = Lexing.lexeme_stop lb
}
exception Error of t * string
let fail t fmt =
Printf.ksprintf (fun msg -> raise (File_error (t, msg))) fmt
let fail_lex lb fmt =
fail (of_lexbuf lb) fmt