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 ParseSessstart_pos: BytePosExpand description
Initial position, read-only.
pos: BytePosExpand description
The absolute offset within the source_map of the current character.
end_src_index: usizeExpand description
Stop reading src at this index.
src: &'a strExpand description
Source text to tokenize.
override_span: Option<Span>Implementations
impl<'a> StringReader<'a>[src]
impl<'a> StringReader<'a>[src]pub(super) fn into_token_trees(
self
) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>)[src]
self
) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>)
impl<'a> StringReader<'a>[src]
impl<'a> StringReader<'a>[src]fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span[src]
fn next_token(&mut self) -> (Spacing, Token)[src]
fn next_token(&mut self) -> (Spacing, Token)[src]Returns the next token, and info about preceding whitespace, if any.
fn fatal_span(&self, sp: Span, m: &str) -> FatalError[src]
fn fatal_span(&self, sp: Span, m: &str) -> FatalError[src]Report a fatal lexical error with a given span.
fn fatal_span_(&self, from_pos: BytePos, to_pos: BytePos, m: &str) -> FatalError[src]
fn fatal_span_(&self, from_pos: BytePos, to_pos: BytePos, m: &str) -> FatalError[src]Report a fatal error spanning [from_pos, to_pos).
fn err_span_(&self, from_pos: BytePos, to_pos: BytePos, m: &str)[src]
fn err_span_(&self, from_pos: BytePos, to_pos: BytePos, m: &str)[src]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>[src]
&self,
from_pos: BytePos,
to_pos: BytePos,
m: &str,
c: char
) -> DiagnosticBuilder<'a>
fn cook_lexer_token(
&self,
token: TokenKind,
start: BytePos
) -> Option<TokenKind>[src]
fn cook_lexer_token(
&self,
token: TokenKind,
start: BytePos
) -> Option<TokenKind>[src]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[src]
&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)[src]
&self,
start: BytePos,
suffix_start: BytePos,
kind: LiteralKind
) -> (LitKind, Symbol)
fn src_index(&self, pos: BytePos) -> usize[src]
fn str_from(&self, start: BytePos) -> &str[src]
fn str_from(&self, start: BytePos) -> &str[src]Slice of the source text from start up to but excluding self.pos,
meaning the slice does not include the character self.ch.
fn symbol_from_to(&self, start: BytePos, end: BytePos) -> Symbol[src]
fn symbol_from_to(&self, start: BytePos, end: BytePos) -> Symbol[src]As symbol_from, with an explicit endpoint.
fn str_from_to(&self, start: BytePos, end: BytePos) -> &str[src]
fn str_from_to(&self, start: BytePos, end: BytePos) -> &str[src]Slice of the source text spanning from start up to but excluding end.
fn report_raw_str_error(&self, start: BytePos, opt_err: Option<RawStrError>)[src]
fn report_non_started_raw_string(&self, start: BytePos, bad_char: char) -> ![src]
fn report_unterminated_raw_string(
&self,
start: BytePos,
n_hashes: usize,
possible_offset: Option<usize>,
found_terminators: usize
) -> ![src]
&self,
start: BytePos,
n_hashes: usize,
possible_offset: Option<usize>,
found_terminators: usize
) -> !
fn report_too_many_hashes(&self, start: BytePos, found: usize) -> ![src]
fn report_too_many_hashes(&self, start: BytePos, found: usize) -> ![src]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
fn validate_literal_escape(
&self,
mode: Mode,
content_start: BytePos,
content_end: BytePos,
prefix_len: u32,
postfix_len: u32
)[src]
&self,
mode: Mode,
content_start: BytePos,
content_end: BytePos,
prefix_len: u32,
postfix_len: u32
)
fn validate_int_literal(
&self,
base: Base,
content_start: BytePos,
content_end: BytePos
)[src]
&self,
base: Base,
content_start: BytePos,
content_end: BytePos
)