Release coccinelle-0.1.1
[bpt/coccinelle.git] / parsing_c / parse_c.mli
1 (* Copyright (C) 2002-2008 Yoann Padioleau
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License (GPL)
5 * version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * file license.txt for more details.
11 *)
12 open Common
13
14 (* The main function is parse_c_and_cpp. It uses globals in Lexer_Parser and
15 * Parsing_hacks. Especially Parsing_hacks._defs which often comes
16 * from a standard.h macro file. Cf also init_defs below.
17 *)
18
19 (* the token list contains now also the comment-tokens *)
20 type info_item = (string * Parser_c.token list)
21
22 type program2 = toplevel2 list
23 and toplevel2 = Ast_c.toplevel * info_item
24
25 type parsing_stat = {
26 filename: filename;
27 mutable have_timeout: bool;
28 mutable correct: int;
29 mutable bad: int;
30 mutable commentized: int;
31 }
32
33 (* This is the main function *)
34 val parse_print_error_heuristic:
35 filename (*cfile*) -> (program2 * parsing_stat)
36 val parse_c_and_cpp : (* alias of previous func *)
37 filename (*cfile*) -> (program2 * parsing_stat)
38
39 val parse_cpp_define_file :
40 filename -> (string, Parsing_hacks.define_body) assoc
41
42 val init_defs : filename -> unit
43
44
45
46
47
48
49 val tokens: filename -> Parser_c.token list
50 val tokens_string: string -> Parser_c.token list
51
52 val parse: filename -> Ast_c.program
53 val parse_print_error: filename -> Ast_c.program
54 val parse_gen:
55 ((Lexing.lexbuf -> Parser_c.token) -> Lexing.lexbuf -> 'a) -> string -> 'a
56
57 (* easy way to build complex Ast elements from simple strings *)
58 val type_of_string : string -> Ast_c.fullType
59 val statement_of_string : string -> Ast_c.statement
60
61
62 (* use some .ast_raw memoized version, and take care if obsolete *)
63 val parse_cache:
64 filename (*cfile*) -> (program2 * parsing_stat)
65
66
67 val print_parsing_stat_list: parsing_stat list -> unit
68 val print_commentized : Parser_c.token list -> unit
69
70