public struct SourceLocation: Sendable, Equatable, Hashable { public let line: Int public let column: Int /// Offset in Unicode scalars, not UTF-8 bytes or grapheme clusters. public let offset: Int public init(line: Int = 1, column: Int = 1, offset: Int = 0) { self.line = line self.column = column self.offset = offset } } public struct SourceRange: Sendable, Equatable { public let start: SourceLocation public let end: SourceLocation public init(start: SourceLocation, end: SourceLocation) { self.start = start self.end = end } } public struct ConfigDiagnostic: Error, Sendable, Equatable, CustomStringConvertible { public enum Severity: String, Sendable { case warning, error } public let severity: Severity public let location: SourceLocation public let message: String public let relatedLocation: SourceLocation? public init( severity: Severity = .error, location: SourceLocation = SourceLocation(), message: String, relatedLocation: SourceLocation? = nil ) { self.severity = severity self.location = location self.message = message self.relatedLocation = relatedLocation } public var description: String { ConfigText.position(line: location.line, column: location.column, message: message) } } public indirect enum TOMLValue: Sendable, Equatable { case string(String) case integer(Int64) case float(Double) case bool(Bool) case array([TOMLNode]) case table([String: TOMLNode]) } public struct TOMLNode: Sendable, Equatable { public let value: TOMLValue public let range: SourceRange public let keyRange: SourceRange? public init(value: TOMLValue, range: SourceRange, keyRange: SourceRange? = nil) { self.value = value self.range = range self.keyRange = keyRange } public subscript(key: String) -> TOMLNode? { guard case .table(let entries) = value else { return nil } return entries[key] } } public enum TOMLPathComponent: Sendable, Equatable, Hashable { case key(String) case index(Int) }