pub struct StoredComment { /* private fields */ }Expand description
Represents a comment stored while lexing the file. Port of StoredComment.
Implementations§
Source§impl StoredComment
impl StoredComment
Sourcepub fn new(kind: CommentKind, range: SMRange) -> StoredComment
pub fn new(kind: CommentKind, range: SMRange) -> StoredComment
A comment of kind spanning range, delimiters included.
Sourcepub fn kind(&self) -> CommentKind
pub fn kind(&self) -> CommentKind
\return whether this is a line, block, or hashbang comment.
Sourcepub fn source_range(&self) -> SMRange
pub fn source_range(&self) -> SMRange
\return the source range of the comment, delimiters included.
Sourcepub fn get_string<'a>(&self, buffer: &'a [u8]) -> &'a [u8] ⓘ
pub fn get_string<'a>(&self, buffer: &'a [u8]) -> &'a [u8] ⓘ
\return the comment with delimiters (//, /*, */, #!) stripped. Port of
StoredComment::getString (JSLexer.h:339-347).
Unlike the C++, which dereferences pointers into the source buffer, our
offset-based comment can’t deref a pointer, so the caller passes the
source buffer bytes and we slice into it.
Sourcepub fn get_full_string<'a>(&self, buffer: &'a [u8]) -> &'a [u8] ⓘ
pub fn get_full_string<'a>(&self, buffer: &'a [u8]) -> &'a [u8] ⓘ
\return the comment with delimiters (//, /*, */, #!) included. Port of
StoredComment::getFullString (JSLexer.h:349-355).
Unlike the C++, which dereferences pointers into the source buffer, our
offset-based comment can’t deref a pointer, so the caller passes the
source buffer bytes and we slice into it.
Trait Implementations§
Source§impl Clone for StoredComment
impl Clone for StoredComment
Source§fn clone(&self) -> StoredComment
fn clone(&self) -> StoredComment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more