PureXML/Sources/Parsing/Mark.swift
Mihaela Mihaljevic 708390242c chore: scaffold PureXML pure-Swift XML package
Root Swift package mirroring PureYAML's structure, rules, and verification
gates. Includes the XML node model (Node, Element, Attribute, QualifiedName),
a working emitter (Serializer) with escaping and pretty/compact options, and
structural validation. The parser surface is stable; parse() raises
notImplemented until the scanner lands, pinned by a test.

- dependency-free, namespaced under PureXML
- portability and style gates carried over (style, namespacing, forbidden
  patterns, swiftformat, swiftlint, linux, wasm, windows CI)
- 11 tests passing
2026-06-07 23:20:20 +02:00

25 lines
783 B
Swift

public extension PureXML.Parsing {
/// A position in the source text, used for parser diagnostics.
struct Mark: Equatable, Hashable, Sendable, CustomStringConvertible {
/// One-based line number.
public var line: Int
/// One-based column number.
public var column: Int
/// Zero-based scalar offset from the start of the input.
public var offset: Int
public init(line: Int, column: Int, offset: Int) {
self.line = line
self.column = column
self.offset = offset
}
/// The start of any input.
public static let start = Mark(line: 1, column: 1, offset: 0)
public var description: String {
"line \(line), column \(column)"
}
}
}