Struct rustc_lexer::cursor::Cursor [−][src]
Expand description
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]
impl<'a> Cursor<'a>[src]pub(crate) fn new(input: &'a str) -> Cursor<'a>[src]
pub(crate) fn prev(&self) -> char[src]
pub(crate) fn prev(&self) -> char[src]Returns the last eaten symbol (or '\0' in release builds).
(For debug assertions only.)
fn nth_char(&self, n: usize) -> char[src]
fn nth_char(&self, n: usize) -> char[src]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]
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]
pub(crate) fn second(&self) -> char[src]Peeks the second symbol from the input stream without consuming it.
pub(crate) fn len_consumed(&self) -> usize[src]
pub(crate) fn len_consumed(&self) -> usize[src]Returns amount of already consumed symbols.
impl Cursor<'_>[src]
impl Cursor<'_>[src]pub(crate) fn advance_token(&mut self) -> Token[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]
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]
pub(crate) fn raw_double_quoted_string(
&mut self,
prefix_len: usize
) -> (u16, Option<RawStrError>)[src]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]
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.