pub struct CPreprocessor { /* private fields */ }Expand description
C Preprocessor simulation for better parsing
Implementations§
Source§impl CPreprocessor
impl CPreprocessor
pub fn new() -> Self
Sourcepub fn is_type_macro(&self, name: &str) -> bool
pub fn is_type_macro(&self, name: &str) -> bool
Check if an identifier is a known type macro
Sourcepub fn get_type_expansion(&self, name: &str) -> Option<&str>
pub fn get_type_expansion(&self, name: &str) -> Option<&str>
Get the expansion hint for a type macro
Sourcepub fn is_attribute_macro(&self, name: &str) -> bool
pub fn is_attribute_macro(&self, name: &str) -> bool
Check if an identifier is a known attribute macro
Sourcepub fn is_function_wrapper(&self, name: &str) -> bool
pub fn is_function_wrapper(&self, name: &str) -> bool
Check if an identifier is a function wrapper macro
Sourcepub fn is_module_macro(&self, name: &str) -> bool
pub fn is_module_macro(&self, name: &str) -> bool
Check if an identifier is a module declaration macro
Sourcepub fn classify_macro(&self, name: &str) -> MacroKind
pub fn classify_macro(&self, name: &str) -> MacroKind
Classify a macro by name
Sourcepub fn preprocess(&self, source: &str) -> String
pub fn preprocess(&self, source: &str) -> String
Preprocess source code to make it more parseable
This performs lightweight transformations:
- Strips problematic attributes
- Normalizes some macro patterns
Sourcepub fn analyze_macros(&self, source: &str) -> Vec<MacroInfo>
pub fn analyze_macros(&self, source: &str) -> Vec<MacroInfo>
Get information about all recognized macros in source
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CPreprocessor
impl RefUnwindSafe for CPreprocessor
impl Send for CPreprocessor
impl Sync for CPreprocessor
impl Unpin for CPreprocessor
impl UnwindSafe for CPreprocessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more