pub fn sub_span_for_type_name(&self, span: Span) -> Option<Span> {
        let mut toks = self.retokenise_span(span);
        let mut prev = toks.real_token();
        let mut result = None;
        let mut bracket_count = 0;
        loop {
            let next = toks.real_token();

            if (next.tok == token::Lt || next.tok == token::Colon) && bracket_count == 0 &&
               prev.tok.is_ident() {
                result = Some(prev.sp);
            }

            bracket_count += match prev.tok {
                token::Lt => 1,
                token::Gt => -1,
                token::BinOp(token::Shl) => 2,
                token::BinOp(token::Shr) => -2,
                _ => 0,
            };

            if next.tok == token::Eof {
                break;
            }
            prev = next;
        }
        if bracket_count != 0 {
            let loc = self.sess.codemap().lookup_char_pos(span.lo);
            span_bug!(span,
                      "Mis-counted brackets when breaking path? Parsing '{}' \
                       in {}, line {}",
                      self.snippet(span),
                      loc.file.name,
                      loc.line);
        }
        if result.is_none() && prev.tok.is_ident() && bracket_count == 0 {
            return self.make_sub_span(span, Some(prev.sp));
        }
        self.make_sub_span(span, result)
    }
// Return the span for the last ident before a `<` and outside any
// brackets, or the last span.
Return the span for the last ident before a `<` and outside any
brackets, or the last span.
Return the span for the last ident before a ` < ` and outside any brackets or the last span .
pub fn sub_span_for_type_name(&self, span: Span) -> Option<Span> {
        let mut toks = self.retokenise_span(span);
        let mut prev = toks.real_token();
        let mut result = None;
        let mut bracket_count = 0;
        loop {
            let next = toks.real_token();
            if (next.tok == token::Lt || next.tok == token::Colon) && bracket_count == 0 &&
               prev.tok.is_ident() {
                result = Some(prev.sp);
            }
            bracket_count += match prev.tok {
                token::Lt => 1,
                token::Gt => -1,
                token::BinOp(token::Shl) => 2,
                token::BinOp(token::Shr) => -2,
                _ => 0,
            };
            if next.tok == token::Eof {
                break;
            }
            prev = next;
        }
        if bracket_count != 0 {
            let loc = self.sess.codemap().lookup_char_pos(span.lo);
            span_bug!(span,
                      "Mis-counted brackets when breaking path? Parsing '{}' \
                       in {}, line {}",
                      self.snippet(span),
                      loc.file.name,
                      loc.line);
        }
        if result.is_none() && prev.tok.is_ident() && bracket_count == 0 {
            return self.make_sub_span(span, Some(prev.sp));
        }
        self.make_sub_span(span, result)
    }
pub fn sub_span_for_type_name ( & self , span : Span ) -> Option < Span > { let mut toks = self . retokenise_span ( span ) ; let mut prev = toks . real_token ( ) ; let mut result = None ; let mut bracket_count = 0 ; loop { let next = toks . real_token ( ) ; if ( next . tok == token :: Lt || next . tok == token :: Colon ) && bracket_count == 0 && prev . tok . is_ident ( ) { result = Some ( prev . sp ) ; } bracket_count += match prev . tok { token :: Lt => 1 , token :: Gt => - 1 , token :: BinOp ( token :: Shl ) => 2 , token :: BinOp ( token :: Shr ) => - 2 , _ => 0 , } ; if next . tok == token :: Eof { break ; } prev = next ; } if bracket_count != 0 { let loc = self . sess . codemap ( ) . lookup_char_pos ( span . lo ) ; span_bug ! ( span " \
 " self snippet ( span ) loc file name loc line ) ; } if result . is_none ( ) && prev . tok . is_ident ( ) && bracket_count == 0 { return self . make_sub_span ( span , Some ( prev . sp ) ) ; } self . make_sub_span ( span , result ) }
Return the span for the last ident before a `<` and outside any
brackets, or the last span.
Return the span for the last ident before a ` < ` and outside any brackets or the last span .
&self
span
Span
&self
span
Span