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 C |
6 | | NoParam |
7 | | Params of string list | |
ae4735db | 8 | and define_body = |
708f4980 C |
9 | | DefineBody of Parser_c.token list |
10 | | DefineHint of parsinghack_hint | |
11 | ||
12 | (* strongly corresponds to the TMacroXxx in the grammar and lexer and the | |
13 | * MacroXxx in the ast. | |
14 | *) | |
ae4735db | 15 | and parsinghack_hint = |
708f4980 C |
16 | | HintIterator |
17 | | HintDeclarator | |
18 | | HintMacroString | |
19 | | HintMacroStatement | |
20 | | HintAttribute | |
21 | | HintMacroIdentBuilder | |
22 | ||
978fd7e5 C |
23 | val string_of_define_def: define_def -> string |
24 | ||
708f4980 C |
25 | (* This function work by side effect and may generate new tokens |
26 | * in the new_tokens_before field of the token_extended in the | |
ae4735db | 27 | * paren_grouped list. So don't forget to recall |
708f4980 | 28 | * Token_views_c.rebuild_tokens_extented after this call, as well |
978fd7e5 | 29 | * as probably insert_virtual_positions as new tokens |
708f4980 | 30 | * are generated. |
ae4735db | 31 | * |
978fd7e5 C |
32 | * note: it does not do some fixpoint, so the generated code may also |
33 | * contain some macros names. | |
708f4980 | 34 | *) |
ae4735db | 35 | val apply_macro_defs: |
708f4980 C |
36 | msg_apply_known_macro:(string -> unit) -> |
37 | msg_apply_known_macro_hint:(string -> unit) -> | |
978fd7e5 C |
38 | ?evaluate_concatop:bool -> |
39 | ?inplace_when_single:bool -> | |
708f4980 C |
40 | (string, define_def) Hashtbl.t -> |
41 | Token_views_c.paren_grouped list -> unit | |
42 | ||
ae4735db | 43 | (* extracting define_def, e.g. from a standard.h; assume have called |
978fd7e5 | 44 | * fix_tokens_define before to have the TDefEol *) |
ae4735db | 45 | val extract_macros : |
708f4980 | 46 | Parser_c.token list -> (string, define_def) Common.assoc |