Struct syntax::parse::lexer::StringReader[src]
pub struct StringReader<'a> {
pub span_diagnostic: &'a SpanHandler,
pub pos: BytePos,
pub last_pos: BytePos,
pub col: CharPos,
pub curr: Option<char>,
pub filemap: Rc<FileMap>,
pub peek_tok: Token,
pub peek_span: Span,
}Fields
span_diagnostic | |
pos | |
last_pos | |
col | |
curr | |
filemap | |
peek_tok | |
peek_span |
Methods
impl<'a> StringReader<'a>
fn new_raw<'b>(span_diagnostic: &'b SpanHandler, filemap: Rc<FileMap>) -> StringReader<'b>
For comments.rs, which hackily pokes into pos and curr
fn new<'b>(span_diagnostic: &'b SpanHandler, filemap: Rc<FileMap>) -> StringReader<'b>
fn curr_is(&self, c: char) -> bool
fn fatal_span(&self, sp: Span, m: &str) -> !
Report a fatal lexical error with a given span.
fn err_span(&self, sp: Span, m: &str)
Report a lexical error with a given span.
fn with_str_from<T>(&self, start: BytePos, f: |s: &str| -> T) -> T
Calls f with a string slice of the source text spanning from start
up to but excluding self.last_pos, meaning the slice does not include
the character self.curr.
fn bump(&mut self)
Advance the StringReader by one character. If a newline is discovered, add it to the FileMap's list of line start offsets.