Struct rustc_parse::lexer::StringReader [−][src]
Fields
sess: &'a ParseSessstart_pos: BytePosInitial position, read-only.
pos: BytePosThe absolute offset within the source_map of the current character.
end_src_index: usizeStop reading src at this index.
src: &'a strSource text to tokenize.
override_span: Option<Span>Implementations
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]
fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span[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]
Report a fatal lexical error with a given span.
fn err_span(&self, sp: Span, m: &str)[src]
Report a lexical error with a given span.
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]
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]
&self,
token: TokenKind,
start: BytePos
) -> Option<TokenKind>
Turns simple rustc_lexer::TokenKind enum into a rich
librustc_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]
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]
As symbol_from, with an explicit endpoint.
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]
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
)
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
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,