[−][src]Struct rustc_parse::lexer::StringReader

pub(in lexer) 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: 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

impl<'a> StringReader<'a>[src]

pub(in lexer) fn into_token_trees(
    self
) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>)
[src]

impl<'a> StringReader<'a>[src]

pub(in lexer) fn mk_sp(
    &self,
    lo: BytePos,
    hi: BytePos
) -> Span
[src]

pub(in lexer) fn next_token(
    &mut self
) -> (Spacing, Token)
[src]

Returns the next token, and info about preceding whitespace, if any.

pub(in lexer) fn fatal_span(
    &self,
    sp: Span,
    m: &str
) -> FatalError
[src]

Report a fatal lexical error with a given span.

pub(in lexer) fn err_span(
    &self,
    sp: Span,
    m: &str
)
[src]

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]

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]

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]

pub(in lexer) fn cook_lexer_token(
    &self,
    token: TokenKind,
    start: BytePos
) -> Option<TokenKind>
[src]

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]

pub(in lexer) fn cook_lexer_literal(
    &self,
    start: BytePos,
    suffix_start: BytePos,
    kind: LiteralKind
) -> (LitKind, Symbol)
[src]

pub(in lexer) fn src_index(
    &self,
    pos: BytePos
) -> usize
[src]

pub(in lexer) 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.

pub(in lexer) fn symbol_from_to(
    &self,
    start: BytePos,
    end: BytePos
) -> Symbol
[src]

As symbol_from, with an explicit endpoint.

pub(in lexer) fn str_from_to(
    &self,
    start: BytePos,
    end: BytePos
) -> &str
[src]

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]

pub(in lexer) fn report_non_started_raw_string(
    &self,
    start: BytePos,
    bad_char: char
) -> !
[src]

pub(in lexer) fn report_unterminated_raw_string(
    &self,
    start: BytePos,
    n_hashes: usize,
    possible_offset: Option<usize>,
    found_terminators: usize
) -> !
[src]

pub(in lexer) 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 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]

pub(in lexer) fn validate_int_literal(
    &self,
    base: Base,
    content_start: BytePos,
    content_end: BytePos
)
[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.