swc_ecma_lexer/common/lexer/
comments_buffer.rs1use swc_common::{comments::Comment, BytePos};
2
3#[derive(Debug, Clone)]
4pub struct BufferedComment {
5 pub kind: BufferedCommentKind,
6 pub pos: BytePos,
7 pub comment: Comment,
8}
9
10#[derive(Debug, Clone, Copy)]
11pub enum BufferedCommentKind {
12 Leading,
13 Trailing,
14}
15
16pub trait CommentsBufferTrait {
17 fn push_comment(&mut self, comment: BufferedComment);
18 fn push_pending(&mut self, comment: Comment);
19 fn pending_to_comment(&mut self, kind: BufferedCommentKind, pos: BytePos);
20 fn take_comments(&mut self) -> impl Iterator<Item = BufferedComment> + '_;
21}