Struct rustc_parse::lexer::StringReader
source · struct StringReader<'psess, 'src> {
psess: &'psess ParseSess,
start_pos: BytePos,
pos: BytePos,
src: &'src str,
cursor: Cursor<'src>,
override_span: Option<Span>,
nbsp_is_whitespace: bool,
}
Fields§
§psess: &'psess ParseSess
§start_pos: BytePos
Initial position, read-only.
pos: BytePos
The absolute offset within the source_map of the current character.
src: &'src str
Source text to tokenize.
cursor: Cursor<'src>
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<'psess, 'src> StringReader<'psess, 'src>
impl<'psess, 'src> StringReader<'psess, 'src>
pub fn dcx(&self) -> &'psess DiagCtxt
fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span
sourcefn next_token(&mut self) -> (Token, bool)
fn next_token(&mut self) -> (Token, bool)
Returns the next token, paired with a bool indicating if the token was preceded by whitespace.
fn ident(&self, start: BytePos) -> TokenKind
sourcefn lint_unicode_text_flow(&self, start: BytePos)
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.
fn cook_doc_comment( &self, content_start: BytePos, content: &str, comment_kind: CommentKind, doc_style: DocStyle ) -> TokenKind
fn cook_lexer_literal( &self, start: BytePos, end: BytePos, kind: LiteralKind ) -> (LitKind, Symbol)
fn src_index(&self, pos: BytePos) -> usize
sourcefn str_from(&self, start: BytePos) -> &'src str
fn str_from(&self, start: BytePos) -> &'src str
Slice of the source text from start
up to but excluding self.pos
,
meaning the slice does not include the character self.ch
.
sourcefn symbol_from_to(&self, start: BytePos, end: BytePos) -> Symbol
fn symbol_from_to(&self, start: BytePos, end: BytePos) -> Symbol
As symbol_from, with an explicit endpoint.
sourcefn str_from_to(&self, start: BytePos, end: BytePos) -> &'src str
fn str_from_to(&self, start: BytePos, end: BytePos) -> &'src str
Slice of the source text spanning from start
up to but excluding end
.
sourcefn str_from_to_end(&self, start: BytePos) -> &'src str
fn str_from_to_end(&self, start: BytePos) -> &'src str
Slice of the source text spanning from start
until the end
fn report_raw_str_error(&self, start: BytePos, prefix_len: u32) -> !
fn report_non_started_raw_string(&self, start: BytePos, bad_char: char) -> !
fn report_unterminated_raw_string( &self, start: BytePos, n_hashes: u32, possible_offset: Option<u32>, found_terminators: u32 ) -> !
fn report_unterminated_block_comment( &self, start: BytePos, doc_style: Option<DocStyle> )
fn report_unknown_prefix(&self, start: BytePos)
fn report_too_many_hashes(&self, start: BytePos, num: u32) -> !
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)
fn cook_unicode( &self, kind: LitKind, mode: Mode, start: BytePos, end: BytePos, prefix_len: u32, postfix_len: u32 ) -> (LitKind, Symbol)
fn cook_mixed( &self, kind: LitKind, mode: Mode, start: BytePos, end: BytePos, prefix_len: u32, postfix_len: u32 ) -> (LitKind, Symbol)
Auto Trait Implementations§
impl<'psess, 'src> !DynSend for StringReader<'psess, 'src>
impl<'psess, 'src> !DynSync for StringReader<'psess, 'src>
impl<'psess, 'src> Freeze for StringReader<'psess, 'src>
impl<'psess, 'src> !RefUnwindSafe for StringReader<'psess, 'src>
impl<'psess, 'src> !Send for StringReader<'psess, 'src>
impl<'psess, 'src> !Sync for StringReader<'psess, 'src>
impl<'psess, 'src> Unpin for StringReader<'psess, 'src>
impl<'psess, 'src> !UnwindSafe for StringReader<'psess, 'src>
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
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
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