Struct rustc_parse::lexer::StringReader [−][src]
struct StringReader<'a> {
sess: &'a ParseSess,
start_pos: BytePos,
pos: BytePos,
end_src_index: usize,
src: &'a str,
override_span: Option<Span>,
}
Fields
sess: &'a ParseSess
start_pos: BytePos
Initial position, read-only.
pos: BytePos
The absolute offset within the source_map of the current character.
end_src_index: usize
Stop reading src at this index.
src: &'a str
Source text to tokenize.
override_span: Option<Span>
Implementations
Returns the next token, and info about preceding whitespace, if any.
Report a fatal lexical error with a given span.
Report a fatal error spanning [from_pos
, to_pos
).
Report a lexical error spanning [from_pos
, to_pos
).
fn struct_fatal_span_char(
&self,
from_pos: BytePos,
to_pos: BytePos,
m: &str,
c: char
) -> DiagnosticBuilder<'a>
Turns simple rustc_lexer::TokenKind
enum into a rich
rustc_ast::TokenKind
. This turns strings into interned
symbols and runs additional validation.
fn cook_doc_comment(
&self,
content_start: BytePos,
content: &str,
comment_kind: CommentKind,
doc_style: DocStyle
) -> TokenKind
fn cook_lexer_literal(
&self,
start: BytePos,
suffix_start: BytePos,
kind: LiteralKind
) -> (LitKind, Symbol)
Slice of the source text from start
up to but excluding self.pos
,
meaning the slice does not include the character self.ch
.
As symbol_from, with an explicit endpoint.
Slice of the source text spanning from start
up to but excluding end
.
fn report_unterminated_raw_string(
&self,
start: BytePos,
n_hashes: usize,
possible_offset: Option<usize>,
found_terminators: usize
) -> !
Note: It was decided to not add a test case, because it would be too big. https://github.com/rust-lang/rust/pull/50296#issuecomment-392135180
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
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: 56 bytes