Struct syntax::parse::lexer::StringReader
[−]
[src]
pub struct StringReader<'a> {
pub sess: &'a ParseSess,
pub next_pos: BytePos,
pub pos: BytePos,
pub col: CharPos,
pub ch: Option<char>,
pub filemap: Rc<FileMap>,
pub terminator: Option<BytePos>,
pub save_new_lines_and_multibyte: bool,
pub peek_tok: Token,
pub peek_span: Span,
pub fatal_errs: Vec<DiagnosticBuilder<'a>>,
// some fields omitted
}rustc_private)Fields
sess: &'a ParseSess
rustc_private)next_pos: BytePos
rustc_private)The absolute offset within the codemap of the next character to read
pos: BytePos
rustc_private)The absolute offset within the codemap of the current character
col: CharPos
rustc_private)The column of the next character to read
ch: Option<char>
rustc_private)The current character (which has been read from self.pos)
filemap: Rc<FileMap>
rustc_private)terminator: Option<BytePos>
rustc_private)If Some, stop reading the source at this position (inclusive).
save_new_lines_and_multibyte: bool
rustc_private)Whether to record new-lines and multibyte chars in filemap. This is only necessary the first time a filemap is lexed. If part of a filemap is being re-lexed, this should be set to false.
peek_tok: Token
rustc_private)peek_span: Span
rustc_private)fatal_errs: Vec<DiagnosticBuilder<'a>>
rustc_private)Methods
impl<'a> StringReader<'a>[src]
fn parse_all_token_trees(&mut self) -> PResult<'a, TokenStream>
rustc_private)impl<'a> StringReader<'a>[src]
fn real_token(&mut self) -> TokenAndSpan
rustc_private)fn try_next_token(&mut self) -> Result<TokenAndSpan, ()>
rustc_private)Return the next token. EFFECT: advances the string_reader.
fn emit_fatal_errors(&mut self)
rustc_private)fn peek(&self) -> TokenAndSpan
rustc_private)impl<'a> StringReader<'a>[src]
fn new_raw<'b>(sess: &'a ParseSess, filemap: Rc<FileMap>) -> Self
rustc_private)For comments.rs, which hackily pokes into next_pos and ch
fn new(sess: &'a ParseSess, filemap: Rc<FileMap>) -> Self
rustc_private)fn retokenize(sess: &'a ParseSess, span: Span) -> Self
rustc_private)fn ch_is(&self, c: char) -> bool
rustc_private)fn fatal_span(&self, sp: Span, m: &str) -> FatalError
rustc_private)Report a fatal lexical error with a given span.
fn err_span(&self, sp: Span, m: &str)
rustc_private)Report a lexical error with a given span.
fn with_str_from<T, F>(&self, start: BytePos, f: F) -> T where F: FnOnce(&str) -> T
rustc_private)Calls f with a string slice of the source text spanning from start
up to but excluding self.pos, meaning the slice does not include
the character self.ch.
fn name_from(&self, start: BytePos) -> Name
rustc_private)Create a Name from a given offset to the current offset, each adjusted 1 towards each other (assumes that on either side there is a single-byte delimiter).
fn name_from_to(&self, start: BytePos, end: BytePos) -> Name
rustc_private)As name_from, with an explicit endpoint.
fn bump(&mut self)
rustc_private)Advance the StringReader by one character. If a newline is discovered, add it to the FileMap's list of line start offsets.
fn nextch(&self) -> Option<char>
rustc_private)fn nextch_is(&self, c: char) -> bool
rustc_private)fn nextnextch(&self) -> Option<char>
rustc_private)fn nextnextch_is(&self, c: char) -> bool
rustc_private)