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;
4
4
pub use crate :: ir:: derive:: CanDerive as ImplementsTrait ;
5
5
pub use crate :: ir:: enum_ty:: { EnumVariantCustomBehavior , EnumVariantValue } ;
6
6
pub use crate :: ir:: int:: IntKind ;
7
+ pub use cexpr:: token:: Kind as TokenKind ;
8
+ pub use cexpr:: token:: Token ;
7
9
use std:: fmt;
8
10
9
11
/// An enum to allow ignoring parsing of macros.
@@ -49,6 +51,10 @@ pub trait ParseCallbacks: fmt::Debug {
49
51
None
50
52
}
51
53
54
+ /// Modify the contents of a macro
55
+ fn modify_macro ( & self , _name : & str , _tokens : & mut Vec < Token > ) {
56
+ }
57
+
52
58
/// The integer kind an integer macro should have, given a name and the
53
59
/// value of that macro, or `None` if you want the default to be chosen.
54
60
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(
429
429
430
430
let cexpr_tokens = cursor. cexpr_tokens ( ) ;
431
431
432
+ if let Some ( callbacks) = ctx. parse_callbacks ( ) {
433
+ callbacks. modify_macro ( cursor. spelling ( ) , & mut cexpr_tokens) ;
434
+ }
435
+
432
436
let parser = expr:: IdentifierParser :: new ( ctx. parsed_macros ( ) ) ;
433
437
434
438
match parser. macro_definition ( & cexpr_tokens) {
You can’t perform that action at this time.
0 commit comments