struct StringReader<'a> {
    sess: &'a ParseSess,
    start_pos: BytePos,
    pos: BytePos,
    src: &'a str,
    cursor: Cursor<'a>,
    override_span: Option<Span>,
    nbsp_is_whitespace: bool,
}

Fields§

§sess: &'a ParseSess§start_pos: BytePos

Initial position, read-only.

§pos: BytePos

The absolute offset within the source_map of the current character.

§src: &'a str

Source text to tokenize.

§cursor: Cursor<'a>

Cursor for getting lexer tokens.

§override_span: Option<Span>§nbsp_is_whitespace: bool

When a “unknown start of token: \u{a0}” has already been emitted earlier in this file, it’s safe to treat further occurrences of the non-breaking space character as whitespace.

Implementations§

source§

impl<'a> StringReader<'a>

source

fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span

source

fn next_token(&mut self) -> (Token, bool)

Returns the next token, paired with a bool indicating if the token was preceded by whitespace.

source

fn ident(&self, start: BytePos) -> TokenKind

source

fn struct_fatal_span_char( &self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char ) -> DiagnosticBuilder<'a, !>

source

fn lint_unicode_text_flow(&self, start: BytePos)

Detect usages of Unicode codepoints changing the direction of the text on screen and loudly complain about it.

source

fn cook_doc_comment( &self, content_start: BytePos, content: &str, comment_kind: CommentKind, doc_style: DocStyle ) -> TokenKind

source

fn cook_lexer_literal( &self, start: BytePos, end: BytePos, kind: LiteralKind ) -> (LitKind, Symbol)

source

fn src_index(&self, pos: BytePos) -> usize

source

fn str_from(&self, start: BytePos) -> &'a str

Slice of the source text from start up to but excluding self.pos, meaning the slice does not include the character self.ch.

source

fn symbol_from_to(&self, start: BytePos, end: BytePos) -> Symbol

As symbol_from, with an explicit endpoint.

source

fn str_from_to(&self, start: BytePos, end: BytePos) -> &'a str

Slice of the source text spanning from start up to but excluding end.

source

fn str_from_to_end(&self, start: BytePos) -> &'a str

Slice of the source text spanning from start until the end

source

fn report_raw_str_error(&self, start: BytePos, prefix_len: u32) -> !

source

fn report_non_started_raw_string(&self, start: BytePos, bad_char: char) -> !

source

fn report_unterminated_raw_string( &self, start: BytePos, n_hashes: u32, possible_offset: Option<u32>, found_terminators: u32 ) -> !

source

fn report_unterminated_block_comment( &self, start: BytePos, doc_style: Option<DocStyle> )

source

fn report_unknown_prefix(&self, start: BytePos)

source

fn report_too_many_hashes(&self, start: BytePos, num: u32) -> !

source

fn cook_common( &self, kind: LitKind, mode: Mode, start: BytePos, end: BytePos, prefix_len: u32, postfix_len: u32, unescape: fn(_: &str, _: Mode, _: &mut dyn FnMut(Range<usize>, Result<(), EscapeError>)) ) -> (LitKind, Symbol)

source

fn cook_quoted( &self, kind: LitKind, mode: Mode, start: BytePos, end: BytePos, prefix_len: u32, postfix_len: u32 ) -> (LitKind, Symbol)

source

fn cook_c_string( &self, kind: LitKind, mode: Mode, start: BytePos, end: BytePos, prefix_len: u32, postfix_len: u32 ) -> (LitKind, Symbol)

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for StringReader<'a>

§

impl<'a> !Send for StringReader<'a>

§

impl<'a> !Sync for StringReader<'a>

§

impl<'a> Unpin for StringReader<'a>

§

impl<'a> !UnwindSafe for StringReader<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 72 bytes