pub struct Module {Show 19 fields
pub arena: Vec<Node>,
pub bindings: HashMap<String, NodeId>,
pub graph: DiGraph<NodeId, ()>,
pub node_to_graph: HashMap<NodeId, NodeIndex>,
pub root: Option<NodeId>,
pub schemas: HashMap<String, NodeId>,
pub diagnostics: Vec<Diagnostic>,
pub source_name: String,
pub node_spans: HashMap<NodeId, Span>,
pub node_files: HashMap<NodeId, String>,
pub healing: Vec<Diagnostic>,
pub trivia: Vec<TriviaComment>,
pub source_style: Style,
pub includes: Vec<IncludeStmt>,
pub profiles: IndexMap<String, NodeId>,
pub patches: Vec<NodeId>,
pub schema: Option<NodeId>,
pub annotations: HashMap<NodeId, Vec<Annotation>>,
pub depends_on: HashMap<NodeId, DependsOn>,
}Fields§
§arena: Vec<Node>§bindings: HashMap<String, NodeId>§graph: DiGraph<NodeId, ()>§node_to_graph: HashMap<NodeId, NodeIndex>§root: Option<NodeId>§schemas: HashMap<String, NodeId>§diagnostics: Vec<Diagnostic>§source_name: String§node_spans: HashMap<NodeId, Span>Source spans for nodes, recorded by the parser so evaluation-time diagnostics can point at real positions.
node_files: HashMap<NodeId, String>Source file per node, parallel to node_spans (C-025 includes).
healing: Vec<Diagnostic>Healing diagnostics (H0xx): repairs the parser applied or declined,
with confidence scores. Separate from diagnostics so callers can
apply mode-dependent gating.
trivia: Vec<TriviaComment>Comments with their normative attachment (spec/dual-syntax.md §7-§8), recorded so the formatter can re-emit them losslessly.
source_style: StyleThe layout style the source predominantly used (for Preserve mode).
includes: Vec<IncludeStmt>Include statements in source order (spec §2.7). The formatter re-emits them; evaluation merges them per the defaults rule, so the composed tree does not need them.
profiles: IndexMap<String, NodeId>Named profiles in source order (spec §2.8, C-027). Never exported directly; the selected one merges into the root value at evaluation.
patches: Vec<NodeId>Structural patch directives in source order (spec §2.9, C-028). Applied to the evaluated value tree after profile merge.
schema: Option<NodeId>The document schema tree (spec §2.10, C-030): the root schema
table and every nested one, extracted from value fields at parse.
None when the document declares no schema. C-031 validates
against it.
annotations: HashMap<NodeId, Vec<Annotation>>Parsed # @… annotations by annotated node (spec/annotations.md,
C-033): intent documentation, constraint predicates, and
immutability flags for validators, the language server, and AI
tooling. Comments themselves stay in trivia for the formatter.
depends_on: HashMap<NodeId, DependsOn>Dependency declarations by scope table (spec/linter.md §2,
C-042): depends_on keys holding string arrays are extracted
from value fields at parse (never exported) and recorded here
against their scope’s table node.
Implementations§
Source§impl Module
impl Module
pub fn new(source_name: impl Into<String>) -> Self
pub fn add_node(&mut self, node: Node) -> NodeId
pub fn add_edge(&mut self, from: NodeId, to: NodeId)
pub fn get(&self, id: NodeId) -> Option<&Node>
pub fn get_mut(&mut self, id: NodeId) -> Option<&mut Node>
Sourcepub fn record_span(&mut self, id: NodeId, span: Span)
pub fn record_span(&mut self, id: NodeId, span: Span)
Record the source span of a node for evaluation-time diagnostics.
Sourcepub fn record_file(&mut self, id: NodeId, file: String)
pub fn record_file(&mut self, id: NodeId, file: String)
Record the source file of a node (includes, C-025).
Sourcepub fn value_paths(&self) -> HashMap<NodeId, String>
pub fn value_paths(&self) -> HashMap<NodeId, String>
Dotted paths for value nodes walked from the document root
(server.port), plus binding names for let values. Unmapped
nodes (schema internals, constraint expressions, orphans) are
absent: callers skip what they cannot name rather than
guessing. Shared by the linter and the language server (C-043
hover/definition).
Sourcepub fn resolve_value_path(&self, path: &str) -> Option<NodeId>
pub fn resolve_value_path(&self, path: &str) -> Option<NodeId>
Resolve a dotted path from the document root to a value-table
node (C-042): each segment indexes a Node::Table’s fields.
A single segment additionally resolves let bindings (table
fields win ties). Returns None for missing keys, non-table
hops, and a missing root. Shared by graph construction
(depends_on edges) and the linter (dangling-path detection),
so both agree on what resolves.