Struct syntex_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, // some fields omitted }
Fields
span_diagnostic | |
pos | The absolute offset within the codemap of the next character to read |
last_pos | The absolute offset within the codemap of the last character read(curr) |
col | The column of the next character to read |
curr | The last character to be read |
filemap | |
peek_tok | |
peek_span |
Methods
impl<'a> StringReader<'a>
[src]
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) -> FatalError
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 help_span(&self, sp: Span, m: &str)
Suggest some help with a given span.
fn with_str_from<T, F>(&self, start: BytePos, f: F) -> T where F: FnOnce(&str) -> 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 name_from(&self, start: BytePos) -> Name
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
As name_from, with an explicit endpoint.
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.
fn nextch(&self) -> Option<char>
fn nextch_is(&self, c: char) -> bool
fn nextnextch(&self) -> Option<char>
fn nextnextch_is(&self, c: char) -> bool
Trait Implementations
impl<'a> Reader for StringReader<'a>
[src]
fn is_eof(&self) -> bool
fn next_token(&mut self) -> TokenAndSpan
Return the next token. EFFECT: advances the string_reader.
fn fatal(&self, m: &str) -> FatalError
Report a fatal error with the current span.
fn err(&self, m: &str)
Report a non-fatal error with the current span.
fn peek(&self) -> TokenAndSpan
fn real_token(&mut self) -> TokenAndSpan
Get a token the parser cares about.