Module leo_span::source_map
source ยท Expand description
The source map provides an address space for positions in spans that is global across the source files that are compiled together. The source files are organized in a sequence, with the positions of each source following the ones of the previous source in the address space of positions (except for the first source, which starts at the beginning of the address space). This way, any place in any source is identified by a single position within the address space covered by the sequence of sources; the source file is determined from the position.
Structsยง
- File / Line / Column information on a
BytePos
. - MultiByteChar ๐Identifies an offset of a multi-byte character in a
SourceFile
. - A single source in the
SourceMap
. - The source map containing all recorded sources, methods to register new ones, and methods to query about spans in relation to recorded sources.
- SourceMapInner ๐Actual data of the source map. We use this setup for purposes of interior mutability.
- Detailed information on a
Span
.
Enumsยง
- A file name.
Functionsยง
- analyze_source_file ๐Finds all newlines, multi-byte characters, and non-narrow characters in a SourceFile.
- Is the env var
LEO_TESTFRAMEWORK
not enabled? - normalize_newlines ๐Replaces
\r\n
with\n
in-place insrc
. - normalize_src ๐Normalizes the source code and records the normalizations.
- remove_bom ๐Removes UTF-8 BOM, if any.