Struct static_analyser::codemap::FileMap
[−]
[src]
pub struct FileMap { /* fields omitted */ }A mapping which keeps track of a file's contents and allows you to cheaply access substrings of the original content.
Methods
impl FileMap[src]
fn filename(&self) -> &str
Get the name of this FileMap.
fn contents(&self) -> &str
Get the entire content of this file.
fn lookup(&self, span: Span) -> Option<&str>
Lookup a span in this FileMap.
Panics
If the FileMap's items hashmap contains a span, but that span
doesn't point to a valid substring this will panic. If you ever
get into a situation like this then things are almost certainly FUBAR.
fn range_of(&self, span: Span) -> Option<Range<usize>>
Get the range corresponding to this span.
impl FileMap[src]
fn insert_span(&self, start: usize, end: usize) -> Span
Ask the FileMap to give you the span corresponding to the half-open
interval [start, end).
Panics
In debug mode, this will panic if either start or end are outside
the source code or if they don't lie on a codepoint boundary.
It is assumed that the start and indices were originally obtained
from the file's contents.
fn merge(&self, first: Span, second: Span) -> Span
Merge two spans to get the span which includes both.
As usual, the constraints from insert_span() also apply here. If
you try to enter two spans from different FileMaps, it'll panic.
impl FileMap[src]
fn register_tokens(&self, tokens: Vec<(TokenKind, usize, usize)>) -> Vec<Token>
Register a set of tokenized inputs and turn them into a proper stream
of tokens. Note that all the caveats from insert_span() also apply
here.
Trait Implementations
impl Clone for FileMap[src]
fn clone(&self) -> FileMap
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more