[−][src]Struct rustc_parse::lexer::StringReader
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(in lexer) fn into_token_trees(
self
) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>)[src]
self
) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>)
impl<'a> StringReader<'a>[src]
pub(in lexer) fn mk_sp(
&self,
lo: BytePos,
hi: BytePos
) -> Span[src]
&self,
lo: BytePos,
hi: BytePos
) -> Span
pub(in lexer) fn next_token(
&mut self
) -> (Spacing, Token)[src]
&mut self
) -> (Spacing, Token)
Returns the next token, and info about preceding whitespace, if any.
pub(in lexer) fn fatal_span(
&self,
sp: Span,
m: &str
) -> FatalError[src]
&self,
sp: Span,
m: &str
) -> FatalError
Report a fatal lexical error with a given span.
pub(in lexer) fn err_span(
&self,
sp: Span,
m: &str
)[src]
&self,
sp: Span,
m: &str
)
Report a lexical error with a given span.
pub(in lexer) fn fatal_span_(
&self,
from_pos: BytePos,
to_pos: BytePos,
m: &str
) -> FatalError[src]
&self,
from_pos: BytePos,
to_pos: BytePos,
m: &str
) -> FatalError
Report a fatal error spanning [from_pos, to_pos).
pub(in lexer) fn err_span_(
&self,
from_pos: BytePos,
to_pos: BytePos,
m: &str
)[src]
&self,
from_pos: BytePos,
to_pos: BytePos,
m: &str
)
Report a lexical error spanning [from_pos, to_pos).
pub(in lexer) 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>
pub(in lexer) 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.
pub(in lexer) 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
pub(in lexer) 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)
pub(in lexer) fn src_index(
&self,
pos: BytePos
) -> usize[src]
&self,
pos: BytePos
) -> usize
pub(in lexer) fn str_from(
&self,
start: BytePos
) -> &str[src]
&self,
start: BytePos
) -> &str
Slice of the source text from start up to but excluding self.pos,
meaning the slice does not include the character self.ch.
pub(in lexer) fn symbol_from_to(
&self,
start: BytePos,
end: BytePos
) -> Symbol[src]
&self,
start: BytePos,
end: BytePos
) -> Symbol
As symbol_from, with an explicit endpoint.
pub(in lexer) fn str_from_to(
&self,
start: BytePos,
end: BytePos
) -> &str[src]
&self,
start: BytePos,
end: BytePos
) -> &str
Slice of the source text spanning from start up to but excluding end.
pub(in lexer) fn report_raw_str_error(
&self,
start: BytePos,
opt_err: Option<RawStrError>
)[src]
&self,
start: BytePos,
opt_err: Option<RawStrError>
)
pub(in lexer) fn report_non_started_raw_string(
&self,
start: BytePos,
bad_char: char
) -> ![src]
&self,
start: BytePos,
bad_char: char
) -> !
pub(in lexer) 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
) -> !
pub(in lexer) fn report_too_many_hashes(
&self,
start: BytePos,
found: usize
) -> ![src]
&self,
start: BytePos,
found: usize
) -> !
Note: It was decided to not add a test case, because it would be to big. https://github.com/rust-lang/rust/pull/50296#issuecomment-392135180
pub(in lexer) fn validate_literal_escape(
&self,
mode: Mode,
content_start: BytePos,
content_end: BytePos
)[src]
&self,
mode: Mode,
content_start: BytePos,
content_end: BytePos
)
pub(in lexer) 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>,