File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ pub use crate::ir::analysis::DeriveTrait;
44pub use crate :: ir:: derive:: CanDerive as ImplementsTrait ;
55pub use crate :: ir:: enum_ty:: { EnumVariantCustomBehavior , EnumVariantValue } ;
66pub use crate :: ir:: int:: IntKind ;
7+ pub use cexpr:: token:: Kind as TokenKind ;
8+ pub use cexpr:: token:: Token ;
79use std:: fmt;
810
911/// An enum to allow ignoring parsing of macros.
@@ -49,6 +51,10 @@ pub trait ParseCallbacks: fmt::Debug {
4951 None
5052 }
5153
54+ /// Modify the contents of a macro
55+ fn modify_macro ( & self , _name : & str , _tokens : & mut Vec < Token > ) {
56+ }
57+
5258 /// The integer kind an integer macro should have, given a name and the
5359 /// value of that macro, or `None` if you want the default to be chosen.
5460 fn int_macro ( & self , _name : & str , _value : i64 ) -> Option < IntKind > {
Original file line number Diff line number Diff line change @@ -429,6 +429,10 @@ fn parse_macro(
429429
430430 let cexpr_tokens = cursor. cexpr_tokens ( ) ;
431431
432+ if let Some ( callbacks) = ctx. parse_callbacks ( ) {
433+ callbacks. modify_macro ( cursor. spelling ( ) , & mut cexpr_tokens) ;
434+ }
435+
432436 let parser = expr:: IdentifierParser :: new ( ctx. parsed_macros ( ) ) ;
433437
434438 match parser. macro_definition ( & cexpr_tokens) {
You can’t perform that action at this time.
0 commit comments