Add BAST document parser (typed tree, step 3)
- New src/bast.rs: typed surface over a BAST document — BastDoc, BastDef, BastDefKind, BastStruct, BastField, BastUnion, BastDiscriminator, BastEnum, BastType, BastRef, BastArray, BastRecord. Borrows from the source Value (no clone of the tree). - $ref resolution is a single hash lookup against $defs (#/$defs/<name> only); union variant refs resolved lazily via BastDoc::resolve_typeref / resolve_ref — replaces normalize_refs + inline_union_variant_refs (those stay for now; step 8 removes them). - Untrusted-input safe: every walk returns AlkTypeError::Schema on a malformed document, never panic/unwrap (AGENTS.md §3). Overflow-safe usize parsing via try_from (AGENTS.md §4). - D-BAST-005 enforced: fields array only valid with field-name discriminators; required for them. - Additive only: new pub mod bast + re-exports in lib.rs. No existing re-exports removed (those go in step 8). 47 new tests. Verification: - cargo test --release: 465 pass (379 lib + 86 integration) - cargo clippy --all-targets -- -D warnings: clean - cargo doc --no-deps: clean - cargo build --target wasm32-unknown-unknown --release: clean
This commit is contained in:
1 parent
29134789a9
commit
f2f9c0326c
2 files changed
+1752
No files matched your search
+1747
File diff suppressed because it is too large.
Load diff
@@ -28,6 +28,7 @@
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
pub mod bast;
|
||||
pub mod bast_meta;
|
||||
pub mod builder;
|
||||
pub mod data_access;
|
||||
@@ -42,6 +43,10 @@ pub mod tunion;
|
||||
pub mod validation;
|
||||
|
||||
pub use bast_meta::BAST_META_SCHEMA;
|
||||
pub use bast::{
|
||||
BastArray, BastDef, BastDefKind, BastDiscriminator, BastDoc, BastEnum, BastField, BastRef,
|
||||
BastRecord, BastStruct, BastType, BastUnion,
|
||||
};
|
||||
pub use builder::{Definitions, Discriminator, Schema};
|
||||
pub use engine::{LayoutMode, AlkTypeEngine};
|
||||
pub use error::AlkTypeError;
|
||||
|
||||
Reference in new issue
Block a user