ddn.data.cdm.location

CDM source location tracking.

This module provides the CdmLocation struct for tracking the source position of CDM nodes during parsing and for error reporting.

Types 1

Source location information for CDM nodes.

CdmLocation tracks where a node originated in source text, enabling accurate error messages and roundtrip fidelity.

Examples

auto loc = CdmLocation.at(10, 5, "config.json");
assert(loc.isKnown);
assert(loc.toString() == "config.json:10:5");

auto unknown = CdmLocation.unknown();
assert(!unknown.isKnown);
assert(unknown.toString() == "<unknown location>");
Fields
string source
uint line
uint column
size_t offset
size_t length
Methods
bool isKnown() const pure nothrow @nogc @safeReturns true if this location is known (has valid line/column).
string toString() const pure @safeReturns a human-readable string representation of this location.
CdmLocation unknown() pure nothrow @nogc @safeCreates an unknown location.
CdmLocation at(uint line, uint column, string source = "") pure nothrow @nogc @safeCreates a location at the specified line and column.