Commit | Line | Data |
---|---|---|
978fd7e5 | 1 | (* Expanding or extracting macros, at the token level *) |
708f4980 C |
2 | |
3 | (* corresponds to what is in the yacfe configuration file (e.g. standard.h) *) | |
ae4735db C |
4 | type define_def = string * define_param * define_body |
5 | and define_param = | |
708f4980 | 6 | | NoParam |
abad11c5 C |
7 | | Params of define_arg list |
8 | and define_arg = FixedArg of string | VariadicArg of string | |
ae4735db | 9 | and define_body = |
708f4980 C |
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 | *) | |
ae4735db | 16 | and parsinghack_hint = |
708f4980 C |
17 | | HintIterator |
18 | | HintDeclarator | |
19 | | HintMacroString | |
20 | | HintMacroStatement | |
21 | | HintAttribute | |
22 | | HintMacroIdentBuilder | |
23 | ||
978fd7e5 C |
24 | val string_of_define_def: define_def -> string |
25 | ||
708f4980 C |
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 | |
ae4735db | 28 | * paren_grouped list. So don't forget to recall |
708f4980 | 29 | * Token_views_c.rebuild_tokens_extented after this call, as well |
978fd7e5 | 30 | * as probably insert_virtual_positions as new tokens |
708f4980 | 31 | * are generated. |
ae4735db | 32 | * |
978fd7e5 C |
33 | * note: it does not do some fixpoint, so the generated code may also |
34 | * contain some macros names. | |
708f4980 | 35 | *) |
ae4735db | 36 | val apply_macro_defs: |
708f4980 C |
37 | msg_apply_known_macro:(string -> unit) -> |
38 | msg_apply_known_macro_hint:(string -> unit) -> | |
978fd7e5 C |
39 | ?evaluate_concatop:bool -> |
40 | ?inplace_when_single:bool -> | |
708f4980 C |
41 | (string, define_def) Hashtbl.t -> |
42 | Token_views_c.paren_grouped list -> unit | |
43 | ||
ae4735db | 44 | (* extracting define_def, e.g. from a standard.h; assume have called |
978fd7e5 | 45 | * fix_tokens_define before to have the TDefEol *) |
ae4735db | 46 | val extract_macros : |
708f4980 | 47 | Parser_c.token list -> (string, define_def) Common.assoc |