Release coccinelle-0.1.8
[bpt/coccinelle.git] / parsing_c / cpp_token_c.mli
1 (*
2 * Do stuff involving cpp macros, like expanding some macros,
3 * or try to parse well the body of the define by finding the end of
4 * define virtual end-of-line token.
5 *)
6
7 (* corresponds to what is in the yacfe configuration file (e.g. standard.h) *)
8 type define_def = string * define_param * define_body
9 and define_param =
10 | NoParam
11 | Params of string list
12 and define_body =
13 | DefineBody of Parser_c.token list
14 | DefineHint of parsinghack_hint
15
16 (* strongly corresponds to the TMacroXxx in the grammar and lexer and the
17 * MacroXxx in the ast.
18 *)
19 and parsinghack_hint =
20 | HintIterator
21 | HintDeclarator
22 | HintMacroString
23 | HintMacroStatement
24 | HintAttribute
25 | HintMacroIdentBuilder
26
27 (* This function work by side effect and may generate new tokens
28 * in the new_tokens_before field of the token_extended in the
29 * paren_grouped list. So don't forget to recall
30 * Token_views_c.rebuild_tokens_extented after this call, as well
31 * as probably parsing_hacks.insert_virtual_positions as new tokens
32 * are generated.
33 *)
34 val apply_macro_defs:
35 msg_apply_known_macro:(string -> unit) ->
36 msg_apply_known_macro_hint:(string -> unit) ->
37 (string, define_def) Hashtbl.t ->
38 Token_views_c.paren_grouped list -> unit
39
40 (* generate virtual end-of-line token *)
41 val fix_tokens_define :
42 Parser_c.token list -> Parser_c.token list
43
44 val extract_cpp_define :
45 Parser_c.token list -> (string, define_def) Common.assoc
46