1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Schema parser for `.ferriorm` files.
//!
//! This crate turns a `.ferriorm` schema string into a fully validated
//! [`ferriorm_core::schema::Schema`] IR. It operates in two phases:
//!
//! 1. **Parsing** ([`parser`]) -- a PEG grammar (defined in `grammar.pest`)
//! tokenizes the input and builds a raw [`ferriorm_core::ast::SchemaFile`].
//! 2. **Validation** ([`validator`]) -- resolves types, checks constraints,
//! and produces the canonical [`ferriorm_core::schema::Schema`] consumed by
//! codegen and the migration engine.
//!
//! For convenience, [`parse_and_validate`] combines both steps.
//!
//! # Related crates
//!
//! - `ferriorm_core` -- domain types produced by this crate.
//! - `ferriorm_codegen` -- consumes the `Schema` IR to generate Rust code.
//! - `ferriorm_migrate` -- consumes the `Schema` IR to produce migrations.
pub use parse;
pub use validate;
/// Parse and validate a schema file in one step.
///
/// # Errors
///
/// Returns a [`ParseError`](error::ParseError) if the source fails parsing or validation.