/// Try and parse a macro using all the macros parsed until now.
Try and parse a macro using all the macros parsed until now.
Try and parse a macro using all the macros parsed until now .
fn parse_macro(
    ctx: &BindgenContext,
    cursor: &clang::Cursor,
) -> Option<(Vec<u8>, cexpr::expr::EvalResult)> {
    use cexpr::{expr, nom};
    let mut cexpr_tokens = cursor.cexpr_tokens()?;
    let parser = expr::IdentifierParser::new(ctx.parsed_macros());
    match parser.macro_definition(&cexpr_tokens) {
        nom::IResult::Done(_, (id, val)) => {
            return Some((id.into(), val));
        }
        _ => {}
    }
    // Try without the last token, to workaround a libclang bug in versions
    // previous to 4.0.
    //
    // See:
    //   https://bugs.llvm.org//show_bug.cgi?id=9069
    //   https://reviews.llvm.org/D26446
    cexpr_tokens.pop()?;
    match parser.macro_definition(&cexpr_tokens) {
        nom::IResult::Done(_, (id, val)) => Some((id.into(), val)),
        _ => None,
    }
}
fn parse_macro ( ctx : & BindgenContext , cursor : & clang :: Cursor , ) -> Option < ( Vec < u8 > , cexpr :: expr :: EvalResult ) > { use cexpr :: { expr , nom } ; let mut cexpr_tokens = cursor . cexpr_tokens ( ) ? ; let parser = expr :: IdentifierParser :: new ( ctx . parsed_macros ( ) ) ; match parser . macro_definition ( & cexpr_tokens ) { nom :: IResult :: Done ( _ , ( id , val ) ) => { return Some ( ( id . into ( ) , val ) ) ; } _ => { } } // Try without the last token, to workaround a libclang bug in versions // previous to 4.0. // // See: //   https://bugs.llvm.org//show_bug.cgi?id=9069 //   https://reviews.llvm.org/D26446 cexpr_tokens . pop ( ) ? ; match parser . macro_definition ( & cexpr_tokens ) { nom :: IResult :: Done ( _ , ( id , val ) ) => Some ( ( id . into ( ) , val ) ) , _ => None , } }
Try and parse a macro using all the macros parsed until now.
Try and parse a macro using all the macros parsed until now .
ctx
&BindgenContext
cursor
&clang::Cursor