(self)
combine multiple comment lines
combine multiple comment lines
combine multiple comment lines
def _gather_comments(self):
        # type: () -> Any
        """combine multiple comment lines"""
        comments = []  # type: List[Any]
        if not self.tokens:
            return comments
        if isinstance(self.tokens[0], CommentToken):
            comment = self.tokens.pop(0)
            self.tokens_taken += 1
            comments.append(comment)
        while self.need_more_tokens():
            self.fetch_more_tokens()
            if not self.tokens:
                return comments
            if isinstance(self.tokens[0], CommentToken):
                self.tokens_taken += 1
                comment = self.tokens.pop(0)
                # nprint('dropping2', comment)
                comments.append(comment)
        if len(comments) >= 1:
            self.tokens[0].add_pre_comments(comments)
        # pull in post comment on e.g. ':'
        if not self.done and len(self.tokens) < 2:
            self.fetch_more_tokens()
def _gather_comments ( self ) : # type: () -> Any comments = [ ] # type: List[Any] if not self . tokens : return comments if isinstance ( self . tokens [ 0 ] , CommentToken ) : comment = self . tokens . pop ( 0 ) self . tokens_taken += 1 comments . append ( comment ) while self . need_more_tokens ( ) : self . fetch_more_tokens ( ) if not self . tokens : return comments if isinstance ( self . tokens [ 0 ] , CommentToken ) : self . tokens_taken += 1 comment = self . tokens . pop ( 0 ) # nprint('dropping2', comment) comments . append ( comment ) if len ( comments ) >= 1 : self . tokens [ 0 ] . add_pre_comments ( comments ) # pull in post comment on e.g. ':' if not self . done and len ( self . tokens ) < 2 : self . fetch_more_tokens ( )