Struct codemap::CodeMap
[−]
[src]
pub struct CodeMap { /* fields omitted */ }
A data structure recording source code files for position lookup.
Methods
impl CodeMap
[src]
fn new() -> CodeMap
Creates an empty CodeMap
.
fn add_file(&mut self, name: String, source: String) -> Arc<File>
Adds a file with the given name and contents.
Use the returned File
and its .span
property to create Spans
representing substrings of the file.
fn find_file(&self, pos: Pos) -> &Arc<File>
Looks up the File
that contains the specified position.
fn look_up_pos(&self, pos: Pos) -> Loc
Gets the file, line, and column represented by a Pos
.
fn look_up_span(&self, span: Span) -> SpanLoc
Gets the file and its line and column ranges represented by a Span
.