Skip to main content

Module source_map

Module source_map 

Source
Expand description

Owning source identities for diagnostics across module collections.

A location retains its immutable file name and text even after its source map is dropped. Native definitions use labels with no location.

use adam_lang::{SourceMap, SourceLabel, SourceLocation};
use cel_parser::SourceSpan;
let mut sources = SourceMap::new();
let source = sources.insert("example.adm2", "sheet example {}");
let label = SourceLabel {
    location: Some(SourceLocation { source, span: SourceSpan::new(1, 0, 1, 5) }),
    label: "sheet declaration".into(),
};
drop(sources);
assert_eq!(label.location.unwrap().source.file_name(), "example.adm2");

Structs§

ModuleCause
Shares an immutable diagnostic cause with identity-based equality.
ModuleDiagnostic
Owns a module error message and all sources needed by its labels.
SourceId
Identifies and owns one source independently of its collection’s lifetime.
SourceLabel
Labels a source region, or a source-free native definition without a location.
SourceLocation
Retains a real source owner and its line/column span.
SourceMap
Collects immutable source owners in insertion order without filesystem IO.