Skip to main content

Module span

Module span 

Source
Expand description

Source location tracking for error reporting.

A Span represents a contiguous region of source text using byte offsets. Every token, expression, and error in logicaffeine carries a span, enabling precise error messages that point to the exact location of problems.

§Byte Offsets

Spans use byte offsets, not character indices. This matches Rust’s string slicing semantics: &source[span.start..span.end] extracts the spanned text.

§Example

use logicaffeine_base::Span;

let source = "hello world";
let span = Span::new(0, 5);

assert_eq!(&source[span.start..span.end], "hello");
assert_eq!(span.len(), 5);

Structs§

Span
A byte-offset range in source text.