Release coccinelle-0.1.2
[bpt/coccinelle.git] / parsing_c / parse_c.mli
CommitLineData
34e49164
C
1open Common
2
3(* The main function is parse_c_and_cpp. It uses globals in Lexer_Parser and
4 * Parsing_hacks. Especially Parsing_hacks._defs which often comes
5 * from a standard.h macro file. Cf also init_defs below.
6 *)
7
485bce71 8(* ---------------------------------------------------------------------- *)
34e49164 9type program2 = toplevel2 list
485bce71 10 and toplevel2 = Ast_c.toplevel * info_item
34e49164 11
485bce71
C
12 (* the token list contains now also the comment-tokens *)
13 and info_item = (string * Parser_c.token list)
34e49164 14
485bce71 15(* ---------------------------------------------------------------------- *)
34e49164
C
16(* This is the main function *)
17val parse_print_error_heuristic:
485bce71
C
18 filename (*cfile*) -> (program2 * Parsing_stat.parsing_stat)
19(* alias of previous func *)
20val parse_c_and_cpp :
21 filename (*cfile*) -> (program2 * Parsing_stat.parsing_stat)
34e49164 22
485bce71
C
23(* use some .ast_raw memoized version, and take care if obsolete *)
24val parse_cache:
25 filename (*cfile*) -> (program2 * Parsing_stat.parsing_stat)
26
27
28(* ---------------------------------------------------------------------- *)
34e49164 29val parse_cpp_define_file :
485bce71 30 filename -> (string, Parsing_hacks.define_def) assoc
34e49164
C
31
32val init_defs : filename -> unit
33
34
35
36
37
485bce71
C
38(* ---------------------------------------------------------------------- *)
39(* used also for the standard.h file *)
40val tokens: ?profile:bool -> filename -> Parser_c.token list
41val tokens_of_string: string -> Parser_c.token list
34e49164
C
42
43val parse: filename -> Ast_c.program
44val parse_print_error: filename -> Ast_c.program
45val parse_gen:
46 ((Lexing.lexbuf -> Parser_c.token) -> Lexing.lexbuf -> 'a) -> string -> 'a
47
485bce71
C
48
49
50(* ---------------------------------------------------------------------- *)
51(* Easy way to build complex Ast elements from simple strings.
52 * Can also be useful when called from the ocaml toplevel to test.
53 *)
34e49164
C
54val type_of_string : string -> Ast_c.fullType
55val statement_of_string : string -> Ast_c.statement
485bce71
C
56(* similar but use parse_c_and_cpp and a /tmp/__cocci.c and extract the part *)
57val cstatement_of_string : string -> Ast_c.statement
58val cexpression_of_string : string -> Ast_c.expression
59
34e49164
C
60
61
34e49164 62
485bce71
C
63(* ---------------------------------------------------------------------- *)
64(* a few helpers *)
65val program_of_program2 : program2 -> Ast_c.program
66val with_program2: (Ast_c.program -> Ast_c.program) -> program2 -> program2
34e49164 67
34e49164
C
68val print_commentized : Parser_c.token list -> unit
69
70