Struct syntex_syntax::codemap::CodeMap
[−]
[src]
pub struct CodeMap { pub files: RefCell<Vec<Rc<FileMap>>>, // some fields omitted }
Fields
files: RefCell<Vec<Rc<FileMap>>>
Methods
impl CodeMap
[src]
fn new(path_mapping: FilePathMapping) -> CodeMap
fn with_file_loader(
file_loader: Box<FileLoader>,
path_mapping: FilePathMapping
) -> CodeMap
file_loader: Box<FileLoader>,
path_mapping: FilePathMapping
) -> CodeMap
fn path_mapping(&self) -> &FilePathMapping
fn file_exists(&self, path: &Path) -> bool
fn load_file(&self, path: &Path) -> Result<Rc<FileMap>>
fn files(&self) -> Ref<Vec<Rc<FileMap>>>
fn new_filemap(&self, filename: FileName, src: String) -> Rc<FileMap>
Creates a new filemap without setting its line information. If you don't intend to set the line information yourself, you should use new_filemap_and_lines.
fn new_filemap_and_lines(&self, filename: &str, src: &str) -> Rc<FileMap>
Creates a new filemap and sets its line information.
fn new_imported_filemap(
&self,
filename: FileName,
name_was_remapped: bool,
crate_of_origin: u32,
source_len: usize,
file_local_lines: Vec<BytePos>,
file_local_multibyte_chars: Vec<MultiByteChar>
) -> Rc<FileMap>
&self,
filename: FileName,
name_was_remapped: bool,
crate_of_origin: u32,
source_len: usize,
file_local_lines: Vec<BytePos>,
file_local_multibyte_chars: Vec<MultiByteChar>
) -> Rc<FileMap>
Allocates a new FileMap representing a source file from an external crate. The source code of such an "imported filemap" is not available, but we still know enough to generate accurate debuginfo location information for things inlined from other crates.
fn mk_substr_filename(&self, sp: Span) -> String
fn lookup_char_pos(&self, pos: BytePos) -> Loc
Lookup source information about a BytePos
fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>
Returns Some(span)
, a union of the lhs and rhs span. The lhs must precede the rhs. If
there are gaps between lhs and rhs, the resulting union will cross these gaps.
For this to work, the spans have to be:
* the ctxt of both spans much match
* the lhs span needs to end on the same line the rhs span begins
* the lhs span must start at or before the rhs span
fn span_to_string(&self, sp: Span) -> String
fn span_to_filename(&self, sp: Span) -> FileName
fn span_to_lines(&self, sp: Span) -> FileLinesResult
fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError>
fn span_until_char(&self, sp: Span, c: char) -> Span
Given a Span
, try to get a shorter span ending before the first occurrence of c
char
fn def_span(&self, sp: Span) -> Span
fn get_filemap(&self, filename: &str) -> Option<Rc<FileMap>>
fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos
For a global BytePos compute the local offset within the containing FileMap
fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos
Converts an absolute BytePos to a CharPos relative to the filemap.