1 (* The main function is parse_c_and_cpp. It uses globals in Lexer_Parser and
2 * and also _defs below which often comes from a standard.h macro file.
3 * cf also init_defs_xxx below.
6 type program2
= toplevel2 list
7 and toplevel2
= Ast_c.toplevel
* info_item
8 (* the token list contains now also the comment-tokens *)
9 and info_item
= (string * Parser_c.token list
)
11 (* usually correspond to what is inside your macros.h *)
12 val _defs
: (string, Cpp_token_c.define_def
) Hashtbl.t
ref
13 (* usually correspond to what is inside your standard.h *)
14 val _defs_builtins
: (string, Cpp_token_c.define_def
) Hashtbl.t
ref
16 val init_defs_macros
: Common.filename
-> unit
17 val init_defs_builtins
: Common.filename
-> unit
20 (* This is the main function *)
22 Common.filename
(*cfile*) -> (program2
* Parsing_stat.parsing_stat
)
24 (* use some .ast_raw memoized version, and take care if obsolete *)
26 Common.filename
(*cfile*) -> (program2
* Parsing_stat.parsing_stat
)
29 (* ---------------------------------------------------------------------- *)
30 (* used to extract macros from standard.h, but also now from regular C files
31 * in -extract_macros to later feed an automatically build standard.h *)
33 Common.filename
-> (string, Cpp_token_c.define_def
) Common.assoc
39 (* ---------------------------------------------------------------------- *)
40 (* used also for the standard.h file *)
41 val tokens
: ?profile
:bool -> Common.filename
-> Parser_c.token list
42 val tokens_of_string
: string -> Parser_c.token list
44 val parse
: Common.filename
-> Ast_c.program
45 val parse_print_error
: Common.filename
-> Ast_c.program
47 ((Lexing.lexbuf
-> Parser_c.token
) -> Lexing.lexbuf
-> 'a
) -> string -> 'a
49 (* ---------------------------------------------------------------------- *)
50 (* Easy way to build complex Ast elements from simple strings.
51 * Can also be useful when called from the ocaml toplevel to test.
53 val type_of_string
: string -> Ast_c.fullType
54 val statement_of_string
: string -> Ast_c.statement
56 (* similar but use parse_c_and_cpp and a /tmp/__cocci.c and extract the part *)
57 val cstatement_of_string
: string -> Ast_c.statement
58 val cexpression_of_string
: string -> Ast_c.expression
61 (* ---------------------------------------------------------------------- *)
63 val print_commentized
: Parser_c.token list
-> unit
65 val program_of_program2
: program2
-> Ast_c.program
66 val with_program2
: (Ast_c.program
-> Ast_c.program
) -> program2
-> program2