// Re-parses a path and returns the span for the last identifier in the path
Re-parses a path and returns the span for the last identifier in the path
Re - parses a path and returns the span for the last identifier in the path
pub fn span_for_last_ident(&self, span: Span) -> Option<Span> {
        let mut result = None;
        let mut toks = self.retokenise_span(span);
        let mut bracket_count = 0;
        loop {
            let ts = toks.real_token();
            if ts.tok == token::Eof {
                return self.make_sub_span(span, result)
            }
            if bracket_count == 0 && (ts.tok.is_ident() || ts.tok.is_keyword(keywords::SelfValue)) {
                result = Some(ts.sp);
            }
            bracket_count += match ts.tok {
                token::Lt => 1,
                token::Gt => -1,
                token::BinOp(token::Shr) => -2,
                _ => 0,
            }
        }
    }
pub fn span_for_last_ident ( & self , span : Span ) -> Option < Span > { let mut result = None ; let mut toks = self . retokenise_span ( span ) ; let mut bracket_count = 0 ; loop { let ts = toks . real_token ( ) ; if ts . tok == token :: Eof { return self . make_sub_span ( span , result ) } if bracket_count == 0 && ( ts . tok . is_ident ( ) || ts . tok . is_keyword ( keywords :: SelfValue ) ) { result = Some ( ts . sp ) ; } bracket_count += match ts . tok { token :: Lt => 1 , token :: Gt => - 1 , token :: BinOp ( token :: Shr ) => - 2 , _ => 0 , } } }
Re-parses a path and returns the span for the last identifier in the path
Re - parses a path and returns the span for the last identifier in the path
&self
span
Span