Struct syntex_syntax::codemap::CodeMap [] [src]

pub struct CodeMap {
    pub files: RefCell<Vec<Rc<FileMap>>>,
    // some fields omitted
}

Fields

Methods

impl CodeMap
[src]

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.

Creates a new filemap and sets its line information.

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.

Lookup source information about a BytePos

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 expn_id 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

Returns a formatted string showing the expansion chain of a span

Spans are printed in the following format:

filename:start_line:col: end_line:col snippet Callee: Callee span Callsite: Callsite span

Callees and callsites are printed recursively (if available, otherwise header and span is omitted), expanding into their own callee/callsite spans. Each layer of recursion has an increased indent, and snippets are truncated to at most 50 characters. Finally, recursive calls to the same macro are squashed, with '...' used to represent any number of recursive calls.

Return the source span - this is either the supplied span, or the span for the macro callsite that expanded to it.

Return the source callee.

Returns None if the supplied span has no expansion trace, else returns the NameAndSpan for the macro definition corresponding to the source callsite.

For a global BytePos compute the local offset within the containing FileMap

Converts an absolute BytePos to a CharPos relative to the filemap.

Check if a span is "internal" to a macro in which #[unstable] items can be used (that is, a macro marked with #[allow_internal_unstable]).

Trait Implementations

impl CodeMapper for CodeMap
[src]