package pfff

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file simple_format.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
open Common


let regexp_comment_line = "#.*"

(*****************************************************************************)
(* Helpers *)
(*****************************************************************************)

let cat_and_filter_comments file = 
  let xs = Common.cat file in
  let xs = xs +> List.map 
    (Str.global_replace (Str.regexp regexp_comment_line) "" ) in
  let xs = xs +> Common.exclude Common2.is_blank_string in
  xs

(*****************************************************************************)
(* csv *)


(*****************************************************************************)
(* hierarchy ? header of section like in kernel_files.meta ? *)

(*
  (* split by header of section *)
  ..
    let xs = xs +> Common.split_list_regexp "^[^ ]" in 

    let group = xs +> List.map (fun s -> 
      assert (s =~ "^[ ]+\\([^ ]+\\) *: *\\(.*\\)");
      let (dir, email) = matched2 s in
      let emails = Common.split "[ ,]+" email in
      (dir, emails)
    ) in
    Subsystem ((dir, emails), group)
*)

(*****************************************************************************)
let title_colon_elems_space_separated file = 

  let xs = cat_and_filter_comments file in

  xs +> List.map (fun s -> 
    assert (s =~ "^\\([^ ]+\\):\\(.*\\)");
    let (title, elems_str) = matched2 s in
    let elems = Common.split "[ \t]+" elems_str in
    title, elems
  )
OCaml

Innovation. Community. Security.