Skip to content

Commit

Permalink
Introduce func_macro to ParseCallbacks trait
Browse files Browse the repository at this point in the history
  • Loading branch information
kulp committed Jun 20, 2020
1 parent db52281 commit e4990dd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e4990dd

Please sign in to comment.