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.
8 (* ---------------------------------------------------------------------- *)
9 type program2
= toplevel2 list
10 and toplevel2
= Ast_c.toplevel
* info_item
12 (* the token list contains now also the comment-tokens *)
13 and info_item
= (string * Parser_c.token list
)
15 (* ---------------------------------------------------------------------- *)
16 (* This is the main function *)
17 val parse_print_error_heuristic
:
18 filename
(*cfile*) -> (program2
* Parsing_stat.parsing_stat
)
19 (* alias of previous func *)
21 filename
(*cfile*) -> (program2
* Parsing_stat.parsing_stat
)
23 (* use some .ast_raw memoized version, and take care if obsolete *)
25 filename
(*cfile*) -> (program2
* Parsing_stat.parsing_stat
)
28 (* ---------------------------------------------------------------------- *)
29 val parse_cpp_define_file
:
30 filename
-> (string, Parsing_hacks.define_def
) assoc
32 val init_defs
: filename
-> unit
38 (* ---------------------------------------------------------------------- *)
39 (* used also for the standard.h file *)
40 val tokens
: ?profile
:bool -> filename
-> Parser_c.token list
41 val tokens_of_string
: string -> Parser_c.token list
43 val parse
: filename
-> Ast_c.program
44 val parse_print_error
: filename
-> Ast_c.program
46 ((Lexing.lexbuf
-> Parser_c.token
) -> Lexing.lexbuf
-> 'a
) -> string -> 'a
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.
54 val type_of_string
: string -> Ast_c.fullType
55 val statement_of_string
: string -> Ast_c.statement
57 (* similar but use parse_c_and_cpp and a /tmp/__cocci.c and extract the part *)
58 val cstatement_of_string
: string -> Ast_c.statement
59 val cexpression_of_string
: string -> Ast_c.expression
64 (* ---------------------------------------------------------------------- *)
66 val print_commentized
: Parser_c.token list
-> unit
68 val program_of_program2
: program2
-> Ast_c.program
69 val with_program2
: (Ast_c.program
-> Ast_c.program
) -> program2
-> program2