1 (* Copyright (C) 2002-2008 Yoann Padioleau
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.
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.
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.
19 (* the token list contains now also the comment-tokens *)
20 type info_item
= (string * Parser_c.token list
)
22 type program2
= toplevel2 list
23 and toplevel2
= Ast_c.toplevel
* info_item
27 mutable have_timeout
: bool;
30 mutable commentized
: int;
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
)
39 val parse_cpp_define_file
:
40 filename
-> (string, Parsing_hacks.define_body
) assoc
42 val init_defs
: filename
-> unit
49 val tokens
: filename
-> Parser_c.token list
50 val tokens_string
: string -> Parser_c.token list
52 val parse
: filename
-> Ast_c.program
53 val parse_print_error
: filename
-> Ast_c.program
55 ((Lexing.lexbuf
-> Parser_c.token
) -> Lexing.lexbuf
-> 'a
) -> string -> 'a
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
62 (* use some .ast_raw memoized version, and take care if obsolete *)
64 filename
(*cfile*) -> (program2
* parsing_stat
)
67 val print_parsing_stat_list
: parsing_stat list
-> unit
68 val print_commentized
: Parser_c.token list
-> unit