1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use crate::source::CommentType;
use crate::Loc;
/// A struct that represents a comment in Ruby
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Comment {
/// Location of the comment (starts with `#` and ends with the last char)
pub location: Loc,
/// Kind of the comment
pub kind: CommentType,
}
impl Comment {
/// Returns Location of the comment (starts with `#` and ends with the last char)
pub fn location(&self) -> &Loc {
&self.location
}
/// Returns kind of the comment
pub fn kind(&self) -> &CommentType {
&self.kind
}
pub(crate) fn make(location: Loc, kind: CommentType) -> Self {
Self { location, kind }
}
}