package reason

  1. Overview
  2. Docs
Reason: Syntax & Toolchain for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

reason-3.16.0.tbz
sha256=47b0e43a7d348e2a850658ab4bec5a4fbbb9fd4ff3ec8a1c1816511558c5364e
sha512=0d8dbe33ac17b765ea018522910a333831fec278ae4da25ba039ce4d2d8152f9b2fbba5b40c453241bf4323e55e0dc070170b04caa35742c6e33a7f726feafb3

doc/src/reason.refmt-lib/eol_detect.ml.html

Source file eol_detect.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
type eol =
  | LF
  | CRLF

let show eol = match eol with LF -> "lf" | CRLF -> "crlf"
let default_eol = match Sys.win32 with true -> CRLF | _ -> LF

let get_eol_for_file filename =
  let ic = open_in_bin filename in
  let rec loop prev =
    match input_char ic with
    | '\n' -> if prev = '\r' then CRLF else LF
    | c -> loop c
  in
  let eol = try loop ' ' with End_of_file -> default_eol in
  close_in ic;
  eol
OCaml

Innovation. Community. Security.