Struct syntex_syntax::codemap::FileMap [] [src]

pub struct FileMap {
    pub name: FileName,
    pub src: Option<Rc<String>>,
    pub start_pos: BytePos,
    pub end_pos: BytePos,
    pub lines: RefCell<Vec<BytePos>>,
    pub multibyte_chars: RefCell<Vec<MultiByteChar>>,
}

A single source in the CodeMap.

Fields

name: FileName

The name of the file that the source came from, source that doesn't originate from files has names between angle brackets by convention, e.g. <anon>

src: Option<Rc<String>>

The complete source code

start_pos: BytePos

The start position of this source in the CodeMap

end_pos: BytePos

The end position of this source in the CodeMap

lines: RefCell<Vec<BytePos>>

Locations of lines beginnings in the source code

multibyte_chars: RefCell<Vec<MultiByteChar>>

Locations of multi-byte characters in the source code

Methods

impl FileMap
[src]

fn next_line(&self, pos: BytePos)

EFFECT: register a start-of-line offset in the table of line-beginnings. UNCHECKED INVARIANT: these offsets must be added in the right order and must be in the right places; there is shared knowledge about what ends a line between this file and parse.rs WARNING: pos param here is the offset relative to start of CodeMap, and CodeMap will append a newline when adding a filemap without a newline at the end, so the safe way to call this is with value calculated as filemap.start_pos + newline_offset_relative_to_the_start_of_filemap.

fn get_line(&self, line_number: usize) -> Option<&str>

get a line from the list of pre-computed line-beginnings. line-number here is 0-based.

fn record_multibyte_char(&self, pos: BytePos, bytes: usize)

fn is_real_file(&self) -> bool

fn is_imported(&self) -> bool

Trait Implementations

impl Encodable for FileMap
[src]

fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>

impl Decodable for FileMap
[src]

fn decode<D: Decoder>(d: &mut D) -> Result<FileMap, D::Error>

impl Debug for FileMap
[src]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.