File: id_sexp.ml

package info (click to toggle)
ocaml-containers 3.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,412 kB
  • sloc: ml: 33,221; sh: 122; makefile: 32
file content (14 lines) | stat: -rw-r--r-- 377 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
let pp_sexp s =
  match s with
  | Ok l -> List.iter (fun s -> Format.printf "@[%a@]@." CCSexp.pp s) l
  | Error msg -> Format.printf "error: %s@." msg

let () =
  match Sys.argv with
  | [| _ |] ->
    let s = CCSexp.parse_chan_list stdin in
    pp_sexp s
  | [| _; file |] ->
    let s = CCSexp.parse_file_list file in
    pp_sexp s
  | _ -> failwith "usage: id_sexp [file]"