Expand description
L1 — the lossless Vue-template surface tree (codename Sinopia, Davinci P2-7).
Experimental: the stage API may change in any alpha release; record intentional breaking changes in the release notes.
A sinopia is the preparatory underdrawing beneath a fresco. When the
finished layer is detached from the wall, the sinopia survives as the
byte-faithful record of what was actually drawn — which is this crate’s
contract for Vue templates: parse builds a typed tree
whose in-order render is the exact source bytes, malformed input
included, and a debug verifier asserts that on every construction
(render(tree) == source, the SwiftSyntax import recorded in
docs/davinci/prior-art-toolchains.md).
The tree is emitted by the shared native profile lexer. The generic parse
entry reuses the Vue namespace owner with a neutral syntax policy: its
existing no-v-pre behavior remains distinct from native dialect admission.
This entry now uses the owner’s arena-backed ancestry frames; the lexer
remains one pass without an added pipeline stage or serialization.
Its event stream drives construction without a private re-scan. Armature’s
published callback facade delegates to the same lexer state machine.
§The hole policy (single, documented — L1→L2 consumers read this)
Error tolerance is structural: every consumer sees one uniformly-shaped tree with typed holes, never a per-consumer error special case. Three clauses cover every malformed byte:
- Absent-but-required syntax is a typed
Missinghole at the exact offset where the syntax belongs: an open tag’s>at EOF (OpenTag::gt), a close tag’s>at EOF (CloseTag::gt), an unterminated quoted value’s closing quote (AttrValue::close_quote), an announced-but-absent attribute value (a= >,AttrValue::content) — allTokenStatus::Missingtokens, zero-width — and a required-but-absent end tag, which is the node-level holeElementClose::Missing. - Bytes with no structural home at tree level are a typed
Unexpectednode (SurfaceChild::Unexpected) carrying the verbatim slice: a stray end tag that matches no open element, an empty</>, trailing bytes the tokenizer consumed without reporting structure. - Bytes with no structural home inside a tag ride in the next
token’s
leadingslice, under the diagnostic the tokenizer already reported (a stray/in<div / a>, junk between an end-tag name and its>). In well-formed sourceleadingis pure inter-token whitespace; it is verbatim source either way, so fidelity never depends on well-formedness. This is the one place L1 diverges from SwiftSyntax’sUnexpectedNodes-between-any-two-children — recorded in the P2-7 record with the reasoning.
§Strings and residency
Every string in the tree is a &'a str slice of the input (P1-10: no
owned strings in nodes, ever). Containers are vize_l0::{Box, Vec},
whose const assertion rejects Drop payloads, so the tree is Drop-free
and arena-resident by construction. Node footprints are pinned by
#[cfg(target_pointer_width = "64")]-guarded const asserts in
surface.
Re-exports§
pub use parse::SurfaceError;pub use parse::SurfaceParseOptions;pub use parse::parse;pub use parse::parse_with_options;pub use render::HoleCounts;pub use render::check_fidelity;pub use render::hole_counts;pub use render::render;pub use surface::AttrValue;pub use surface::Attribute;pub use surface::CloseTag;pub use surface::Element;pub use surface::ElementClose;pub use surface::Interpolation;pub use surface::OpenTag;pub use surface::SurfaceChild;pub use surface::SurfaceTree;pub use surface::Token;pub use surface::TokenStatus;
Modules§
- container
- L1 container: the file-format layer (#6837).
- css
- One production CSS parse over an original source-checked SFC style block.
- dialect
- Version-specific syntax policy resolved outside generic surface-tree code.
- edit
- Immutable edits against one retained, host-versioned authored snapshot.
- embed
- Source preparation and the typed-embed boundary for the L1 redesign.
- markup
- L1 markup: the concrete syntax of markup grammars (#6835).
- parse
- The parse entry: L1’s moved tokenizer → event stream → surface tree, with the byte-fidelity verifier asserted on every construction.
- pug
- The lossless pug surface tree — charter #12’s second L1 dialect (Davinci P4-12c).
- render
- Rendering back to source, the byte-fidelity check (TS-19’s oracle), and the typed-hole census the tests pin.
- surface
- The L1 surface-tree node types.