dinoco_compiler/lib.rs
1mod ast;
2mod error;
3mod parser;
4
5pub use ast::*;
6pub use error::*;
7
8pub type CompileResult<T> = Result<T, CompileError>;
9
10/// Parses a schema without running semantic validation.
11///
12/// Editors can use this to report every semantic issue in a syntactically valid
13/// document instead of stopping at the compiler's first validation error.
14pub fn parse(source: &str) -> CompileResult<Schema> {
15 parser::parse_schema(source)
16}
17
18pub fn compile(source: &str) -> CompileResult<Schema> {
19 let schema = parse(source)?;
20 parser::validate_schema(&schema)?;
21 Ok(schema)
22}