Skip to main content

Module registry

Module registry 

Source
Expand description

Sentinel-position → AozoraNode lookup table.

The registry pairs every PUA sentinel position written into the lexer’s normalized text with the AozoraNode (or crate::extension::ContainerKind) that originated it. Downstream renderers walk the normalized text, encounter a sentinel, and node_at(pos) to recover the structured node.

§Layout decision

Stored as one [aozora_veb::EytzingerMap] keyed by normalized byte position. Every entry’s payload is a NodeRef enum that discriminates inline / block-leaf / block-open / block-close hits — pre-Phase-D the four sentinel kinds lived in four independent tables and node_at did a 4-way linear sweep. The single-table layout means one binary search per lookup; renderers pattern-match on the NodeRef variant inline.

Entries are inserted in monotonically increasing position order during the lex pipeline (the classifier emits spans in source order, every sentinel position is therefore strictly greater than the previous), so construction can short-circuit the sort step that a general-purpose builder would need.

Position-keyed map from NormalizedOffset to AST node, backed by [aozora_veb::EytzingerMap] for cache-friendly lookups during render-time traversal.

Structs§

ContainerPair
Resolved (open, close) container-marker pair, in normalized coordinates.
Registry
Whole-document registry — single Eytzinger-keyed table.

Enums§

NodeRef
Unified view over a registry hit, returned by Registry::node_at.