| 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 string list |
| 8 | and define_body = |
| 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 | *) |
| 15 | and parsinghack_hint = |
| 16 | | HintIterator |
| 17 | | HintDeclarator |
| 18 | | HintMacroString |
| 19 | | HintMacroStatement |
| 20 | | HintAttribute |
| 21 | | HintMacroIdentBuilder |
| 22 | |
| 23 | val string_of_define_def: define_def -> string |
| 24 | |
| 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 |
| 27 | * paren_grouped list. So don't forget to recall |
| 28 | * Token_views_c.rebuild_tokens_extented after this call, as well |
| 29 | * as probably insert_virtual_positions as new tokens |
| 30 | * are generated. |
| 31 | * |
| 32 | * note: it does not do some fixpoint, so the generated code may also |
| 33 | * contain some macros names. |
| 34 | *) |
| 35 | val apply_macro_defs: |
| 36 | msg_apply_known_macro:(string -> unit) -> |
| 37 | msg_apply_known_macro_hint:(string -> unit) -> |
| 38 | ?evaluate_concatop:bool -> |
| 39 | ?inplace_when_single:bool -> |
| 40 | (string, define_def) Hashtbl.t -> |
| 41 | Token_views_c.paren_grouped list -> unit |
| 42 | |
| 43 | (* extracting define_def, e.g. from a standard.h; assume have called |
| 44 | * fix_tokens_define before to have the TDefEol *) |
| 45 | val extract_macros : |
| 46 | Parser_c.token list -> (string, define_def) Common.assoc |