pub fn leading_comments_with_previous(&mut self, pos: BytePos) -> CommentsIterator<'a> {
        let mut comment_vecs = Vec::new();

        if self.token_index == 0 {
            // get any comments stored at the beginning of the file
            // todo: investigate what's required here
            self.append_leading(&mut comment_vecs, &BytePos(0));
            self.append_trailing(&mut comment_vecs, &BytePos(0));
        } else if let Some(previous_token) = self.tokens.get(self.token_index - 1) {
            self.append_trailing(&mut comment_vecs, &previous_token.hi());
        }

        loop {
            if let Some(token) = self.tokens.get(self.token_index) {
                self.append_leading(&mut comment_vecs, &token.lo());

                let token_hi = token.hi();
                if token_hi < pos {
                    self.append_trailing(&mut comment_vecs, &token_hi);
                    self.token_index += 1;
                } else {
                    break;
                }
            } else {
                break;
            }
        }

        return CommentsIterator::new(comment_vecs);
    }
/// Gets the leading comments and all previously unhandled comments.
Gets the leading comments and all previously unhandled comments.
Gets the leading comments and all previously unhandled comments .
pub fn leading_comments_with_previous(&mut self, pos: BytePos) -> CommentsIterator<'a> {
        let mut comment_vecs = Vec::new();
        if self.token_index == 0 {
            // get any comments stored at the beginning of the file
            // todo: investigate what's required here
            self.append_leading(&mut comment_vecs, &BytePos(0));
            self.append_trailing(&mut comment_vecs, &BytePos(0));
        } else if let Some(previous_token) = self.tokens.get(self.token_index - 1) {
            self.append_trailing(&mut comment_vecs, &previous_token.hi());
        }
        loop {
            if let Some(token) = self.tokens.get(self.token_index) {
                self.append_leading(&mut comment_vecs, &token.lo());
                let token_hi = token.hi();
                if token_hi < pos {
                    self.append_trailing(&mut comment_vecs, &token_hi);
                    self.token_index += 1;
                } else {
                    break;
                }
            } else {
                break;
            }
        }
        return CommentsIterator::new(comment_vecs);
    }
pub fn leading_comments_with_previous ( & mut self , pos : BytePos ) -> CommentsIterator < ' a > { let mut comment_vecs = Vec :: new ( ) ; if self . token_index == 0 { // get any comments stored at the beginning of the file // todo: investigate what's required here self . append_leading ( & mut comment_vecs , & BytePos ( 0 ) ) ; self . append_trailing ( & mut comment_vecs , & BytePos ( 0 ) ) ; } else if let Some ( previous_token ) = self . tokens . get ( self . token_index - 1 ) { self . append_trailing ( & mut comment_vecs , & previous_token . hi ( ) ) ; } loop { if let Some ( token ) = self . tokens . get ( self . token_index ) { self . append_leading ( & mut comment_vecs , & token . lo ( ) ) ; let token_hi = token . hi ( ) ; if token_hi < pos { self . append_trailing ( & mut comment_vecs , & token_hi ) ; self . token_index += 1 ; } else { break ; } } else { break ; } } return CommentsIterator :: new ( comment_vecs ) ; }
Gets the leading comments and all previously unhandled comments.
Gets the leading comments and all previously unhandled comments .
&mut self
pos
BytePos
&mut self
pos
BytePos