package reason

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

Install

Dune Dependency

Authors

Maintainers

Sources

reason-3.15.0.tbz
sha256=ec3d2025f4391f0d2b88d2053e627a85aa1addd9c51320e9e72c690e05fb66a6
sha512=2bc7681a0e7649f619a8e93e961690531f697fadb1ae5d3f2c5913b0fce6995780394f2ce5b3e1920902ca7a2f4e188f62696f58f20ae3dd81c3658528bd0a33

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.