File: pp.ml

package info (click to toggle)
ppxlib 0.37.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,804 kB
  • sloc: ml: 66,587; sh: 103; makefile: 40; python: 36
file content (16 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
let () =
  match Sys.argv with
  | [| _; ocaml_version_str; fname |] ->
      let ocaml_version =
        match Supported_version.of_string ocaml_version_str with
        | Some v -> string_of_int (Supported_version.to_int v)
        | None ->
            Printf.eprintf "Unknown OCaml version %s\n" ocaml_version_str;
            exit 1
      in
      let ic = open_in_bin fname in
      Printf.printf "# 1 %S\n" fname;
      Pp_rewrite.rewrite ocaml_version (Lexing.from_channel ic)
  | _ ->
      Printf.eprintf "%s: <ocaml-version> <file-name>\n" Sys.executable_name;
      exit 2