Expand description
Source-position tracking for ETDL documents.
The typed AST produced by crate::parse_document carries no source
positions. This module parses the same document a second time with saphyr
(a position-aware YAML 1.2 parser) and builds a SpanIndex that records
the location of every semantic element — sections, tree/node/gate/basic-event
definitions, fields, and identifier reference value tokens.
The index is keyed by the serde output JSON path (e.g.
event_trees.OrderFulfillment.nodes.InventoryCheckBarrier.branches[0].next)
so it can be injected directly into the AST serialization produced by
crate::parse_document.
All line/column numbers are 0-based (LSP convention). start/end are
character offsets into the original document (not UTF-16 code units).
Structs§
- Duplicate
Id - A detected duplicate identifier under a
nodes/gates/basicEventsmap. - Indexed
Element - One recorded element in the
SpanIndex. - Span
- A half-open
[start, end)span into the source document. - Span
Index - A source-position index over an ETDL document.
Enums§
- Element
Kind - The kind of a recorded element, matching the
kindfield offind_span. - Path
Part - A component of an index path: either a map key or a sequence index.
- SpanKey
- A structured locator for a semantic element, used by the validator to attach
positions to diagnostics. Field names use the serde output naming
(e.g.
on_failure,root_cause).
Functions§
- build_
span_ index - Build a
SpanIndexover an ETDL document. - detect_
duplicate_ ids - Detect duplicate ids under
nodes/gates/basicEventsmaps using saphyr’s low-level event stream (duplicate YAML keys are collapsed before the typed AST is built, so they must be caught here). - inject_
spans - Inject
spanobjects into a serialized AST, wrapping scalar leaves that have spans as{ "value": ..., "span": ... }. - parse_
document_ with_ spans - Parse the document with
serde_yaml(producing the typed AST) and build aSpanIndexover the same content.
Type Aliases§
- PathKey
- A path into the serde output JSON (see module docs).