Skip to main content

Module spanned

Module spanned 

Source
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§

DuplicateId
A detected duplicate identifier under a nodes/gates/basicEvents map.
IndexedElement
One recorded element in the SpanIndex.
Span
A half-open [start, end) span into the source document.
SpanIndex
A source-position index over an ETDL document.

Enums§

ElementKind
The kind of a recorded element, matching the kind field of find_span.
PathPart
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 SpanIndex over an ETDL document.
detect_duplicate_ids
Detect duplicate ids under nodes/gates/basicEvents maps 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 span objects 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 a SpanIndex over the same content.

Type Aliases§

PathKey
A path into the serde output JSON (see module docs).