permit multiline comments and strings in macros
[bpt/coccinelle.git] / parsing_c / cpp_token_c.mli
1 (* Expanding or extracting macros, at the token level *)
2
3 (* corresponds to what is in the yacfe configuration file (e.g. standard.h) *)
4 type define_def = string * define_param * define_body
5 and define_param =
6 | NoParam
7 | Params of define_arg list
8 and define_arg = FixedArg of string | VariadicArg of string
9 and define_body =
10 | DefineBody of Parser_c.token list
11 | DefineHint of parsinghack_hint
12
13 (* strongly corresponds to the TMacroXxx in the grammar and lexer and the
14 * MacroXxx in the ast.
15 *)
16 and parsinghack_hint =
17 | HintIterator
18 | HintDeclarator
19 | HintMacroString
20 | HintMacroStatement
21 | HintAttribute
22 | HintMacroIdentBuilder
23
24 val string_of_define_def: define_def -> string
25
26 (* This function work by side effect and may generate new tokens
27 * in the new_tokens_before field of the token_extended in the
28 * paren_grouped list. So don't forget to recall
29 * Token_views_c.rebuild_tokens_extented after this call, as well
30 * as probably insert_virtual_positions as new tokens
31 * are generated.
32 *
33 * note: it does not do some fixpoint, so the generated code may also
34 * contain some macros names.
35 *)
36 val apply_macro_defs:
37 msg_apply_known_macro:(string -> unit) ->
38 msg_apply_known_macro_hint:(string -> unit) ->
39 ?evaluate_concatop:bool ->
40 ?inplace_when_single:bool ->
41 (string, define_def) Hashtbl.t ->
42 Token_views_c.paren_grouped list -> unit
43
44 (* extracting define_def, e.g. from a standard.h; assume have called
45 * fix_tokens_define before to have the TDefEol *)
46 val extract_macros :
47 Parser_c.token list -> (string, define_def) Common.assoc