Expand description
Source-level document representation with layout metadata.
Used for programmatic construction of Eure documents with preserved formatting information (comments, section ordering, etc.). Source-level document representation for programmatic construction and formatting.
This module provides types for representing Eure source structure as an AST,
while actual values are referenced via [NodeId] into an [EureDocument].
The structure directly mirrors the Eure grammar from eure.par:
Eure: [ ValueBinding ] { Binding } { Section } ;
Binding: Keys BindingRhs ;
BindingRhs: ValueBinding | SectionBinding | TextBinding ;
Section: At Keys SectionBody ;
SectionBody: [ ValueBinding ] { Binding } | Begin Eure End ;§Design
SourceDocument
├── EureDocument (semantic data)
└── sources: Vec<EureSource> (arena)
└── EureSource
├── leading_trivia: Vec<Trivia>
├── value: Option<NodeId>
├── bindings: Vec<BindingSource>
│ └── trivia_before: Vec<Trivia>
├── sections: Vec<SectionSource>
│ └── trivia_before: Vec<Trivia>
└── trailing_trivia: Vec<Trivia>Trivia (comments and blank lines) is preserved for round-trip formatting.
Structs§
- Array
Element Source - Layout information for an array element.
- Binding
Source - A binding statement: path followed by value or block.
- Eure
Source - A source-level Eure document/block.
- Section
Source - A section statement:
@ pathfollowed by body. - Source
Document - A document with source structure metadata.
- Source
Id - Index into the sources arena.
- Source
Path Segment - A segment in a source path.
Enums§
- Bind
Source - The right-hand side of a binding.
- Comment
- A comment in the source.
- Section
Body - The body of a section.
- Source
Key - A key in source representation.
- String
Style - Syntax style for string keys (for round-trip formatting).
- Trivia
- Trivia: comments and blank lines that appear between statements.
Type Aliases§
- Source
Path - A path in source representation.