package pfff

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

Source file test_parsing_c.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
open Common

module Stat = Parse_info
(*****************************************************************************)
(* Subsystem testing *)
(*****************************************************************************)

let test_parse_c xs =
  let fullxs = Lib_parsing_c.find_source_files_of_dir_or_files xs in
  let stat_list = ref [] in

  fullxs |> (*Console.progress (fun k -> *) List.iter ((fun file -> 
    (*k(); *)
    pr (spf "PARSING: %s" file);
    let (_xs, stat) = 
      Parse_c.parse file 
    in
    Common.push stat stat_list;
  ));
  Stat.print_recurring_problematic_tokens !stat_list;
  Stat.print_parsing_stat_list !stat_list;
  ()

let test_dump_c file =
  let ast = Parse_c.parse_program file in
  let v = Meta_ast_c.vof_program ast in
  let s = Ocaml.string_of_v v in
  pr s
  
(*****************************************************************************)
(* Main entry for Arg *)
(*****************************************************************************)

let actions () = [
    "-parse_c", "   <file or dir>", 
    Common.mk_action_n_arg test_parse_c;
    "-dump_c", "   <file>", 
    Common.mk_action_1_arg test_dump_c;
]
OCaml

Innovation. Community. Security.