diff options
author | Darren Kulp <darren@kulp.ch> | 2020-05-22 16:50:38 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-06-21 01:40:52 +0200 |
commit | db672a3eb24ab13750e2265fe559dce4eea5fc68 (patch) | |
tree | 703b7e548d297b14c6c3fd6959a4ea0557ef67dc | |
parent | ec6cb2c7c4fc707f9b8ca2a700b6b4f252a3c6e6 (diff) |
Introduce func_macro to ParseCallbacks trait
-rw-r--r-- | src/callbacks.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs index 1b5445e6..051c1160 100644 --- a/src/callbacks.rs +++ b/src/callbacks.rs @@ -35,10 +35,21 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe { None } - /// This will be run on every string macro. The callback can not influence the further + /// This will be run on every string macro. The callback cannot influence the further /// treatment of the macro, but may use the value to generate additional code or configuration. fn str_macro(&self, _name: &str, _value: &[u8]) {} + /// This will be run on every function-like macro. The callback cannot + /// influence the further treatment of the macro, but may use the value to + /// generate additional code or configuration. + /// + /// The first parameter represents the name and argument list (including the + /// parentheses) of the function-like macro. The second parameter represents + /// the expansion of the macro. It is not guaranteed that the whitespace of + /// the original is preserved, but it is guaranteed that tokenization will + /// not be changed. + fn func_macro(&self, _name: &str, _value: &str) {} + /// This function should return whether, given an enum variant /// name, and value, this enum variant will forcibly be a constant. fn enum_variant_behavior( |