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
18 lines
751 B
Swift
18 lines
751 B
Swift
public extension PureXML.Parsing {
|
|
/// The pure-Swift XML parser.
|
|
///
|
|
/// The tokenizing scanner and the well-formedness rules are still being
|
|
/// built out. The public entry points exist and are stable; calling them
|
|
/// today raises ``ParseError/notImplemented(_:)`` so that downstream code
|
|
/// can wire against the final surface before the parser lands.
|
|
struct Parser: Sendable {
|
|
public init() {}
|
|
|
|
/// Parses a single XML document into a ``PureXML/Model/Node/document(_:)`` tree.
|
|
public func parse(_ xml: String) throws -> PureXML.Model.Node {
|
|
guard !xml.isEmpty else { throw ParseError.emptyDocument }
|
|
throw ParseError.notImplemented("document parsing")
|
|
}
|
|
}
|
|
}
|