[−][src]Struct rustc_lexer::cursor::Cursor
Peekable iterator over a char sequence.
Next characters can be peeked via nth_char method,
and position can be shifted forward via bump method.
Fields
initial_len: usizechars: Chars<'a>prev: charImplementations
impl<'a> Cursor<'a>[src]
pub(crate) fn new(input: &'a str) -> Cursor<'a>[src]
pub(crate) fn prev(&self) -> char[src]
Returns the last eaten symbol (or '\0' in release builds).
(For debug assertions only.)
pub(in cursor) fn nth_char(
&self,
n: usize
) -> char[src]
&self,
n: usize
) -> char
Returns nth character relative to the current cursor position.
If requested position doesn't exist, EOF_CHAR is returned.
However, getting EOF_CHAR doesn't always mean actual end of file,
it should be checked with is_eof method.
pub(crate) fn first(&self) -> char[src]
Peeks the next symbol from the input stream without consuming it.
pub(crate) fn second(&self) -> char[src]
Peeks the second symbol from the input stream without consuming it.
pub(crate) fn is_eof(&self) -> bool[src]
Checks if there is nothing more to consume.
pub(crate) fn len_consumed(&self) -> usize[src]
Returns amount of already consumed symbols.
pub(in cursor) fn chars(
&self
) -> Chars<'a>[src]
&self
) -> Chars<'a>
Returns a Chars iterator over the remaining characters.
pub(crate) fn bump(&mut self) -> Option<char>[src]
Moves to the next character.
impl<'_> Cursor<'_>[src]
pub(crate) fn advance_token(&mut self) -> Token[src]
Parses a token from the input string.
pub(crate) fn line_comment(&mut self) -> TokenKind[src]
pub(crate) fn block_comment(&mut self) -> TokenKind[src]
pub(crate) fn whitespace(&mut self) -> TokenKind[src]
pub(crate) fn raw_ident(&mut self) -> TokenKind[src]
pub(crate) fn ident(&mut self) -> TokenKind[src]
pub(crate) fn number(&mut self, first_digit: char) -> LiteralKind[src]
pub(crate) fn lifetime_or_char(&mut self) -> TokenKind[src]
pub(crate) fn single_quoted_string(&mut self) -> bool[src]
pub(crate) fn double_quoted_string(&mut self) -> bool[src]
Eats double-quoted string and returns true if string is terminated.
pub(crate) fn raw_double_quoted_string(
&mut self,
prefix_len: usize
) -> (u16, Option<RawStrError>)[src]
&mut self,
prefix_len: usize
) -> (u16, Option<RawStrError>)
Eats the double-quoted string and returns n_hashes and an error if encountered.
pub(crate) fn raw_string_unvalidated(
&mut self,
prefix_len: usize
) -> (usize, Option<RawStrError>)[src]
&mut self,
prefix_len: usize
) -> (usize, Option<RawStrError>)
pub(crate) fn eat_decimal_digits(&mut self) -> bool[src]
pub(crate) fn eat_hexadecimal_digits(&mut self) -> bool[src]
pub(crate) fn eat_float_exponent(&mut self) -> bool[src]
Eats the float exponent. Returns true if at least one digit was met, and returns false otherwise.
pub(crate) fn eat_literal_suffix(&mut self)[src]
pub(crate) fn eat_identifier(&mut self)[src]
pub(crate) fn eat_while(&mut self, predicate: impl FnMut(char) -> bool)[src]
Eats symbols while predicate returns true or until the end of file is reached.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Cursor<'a>
impl<'a> Send for Cursor<'a>
impl<'a> Sync for Cursor<'a>
impl<'a> Unpin for Cursor<'a>
impl<'a> UnwindSafe for Cursor<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,