pub struct Reader<'a> { /* private fields */ }Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new(text: &'a str) -> Self
pub fn new_with_range(text: &'a str, range: SourceRange) -> Self
pub fn bump(&mut self)
pub fn reset_buff(&mut self)
Sourcepub fn begin_token(&mut self)
pub fn begin_token(&mut self)
Start a new token buffer without relying on Reader::reset_buff’s lazy first-character
handling.
reset_buff only primes the cursor the first time it is called, so any entry point that
lexes outside the normal lex loop — CppLexer::lex_header_name is one — needs this to be
sure current_char is the first character of the token rather than EOF.
pub fn is_eof(&self) -> bool
pub fn is_start_of_line(&self) -> bool
pub fn current_char(&self) -> char
pub fn next_char(&mut self) -> char
Sourcepub fn lookahead(&self, n: usize) -> char
pub fn lookahead(&self, n: usize) -> char
The n-th character after the current one, without consuming anything.
lookahead(0) is the current character. Used to disambiguate prefixes that need more than
one character of context: u8"x" is a string literal while u8x is an identifier, and
R"(...)" is a raw string while R alone is a name.
pub fn saved_range(&self) -> SourceRange
pub fn current_saved_text(&self) -> &str
pub fn eat_when(&mut self, ch: char) -> usize
pub fn consume_char_n_times(&mut self, ch: char, count: usize) -> usize
pub fn eat_while<F>(&mut self, func: F) -> usize
pub fn get_source_text(&self) -> &str
pub fn get_current_end_pos(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnsafeUnpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more