mos_core/lib.rs
1//! Core types for the Mosaic typesetting engine.
2//!
3//! Implements the document model (manifest §5) and diagnostics surface
4//! (manifest §31). Every other crate depends on this one; nothing here
5//! depends on parsing, layout, or backends.
6//!
7//! The implementation is split into focused modules and re-exported flat at
8//! the crate root: consumers use `mos_core::Diagnostic`,
9//! `mos_core::SourceSpan`, etc., never the module paths. Internally:
10//!
11//! - `document`; the lowered semantic node graph ([`Document`], [`Node`],
12//! [`NodeSpec`])
13//! - `span`: source byte-ranges ([`SourceSpan`]) and [`linecol`]
14//! - `diagnostics`: [`Diagnostic`], [`DiagnosticAnnotation`], [`Severity`],
15//! [`Suggestion`]
16//! - [`codes`]; the `MOS####` diagnostic-code registry
17//! - `sink`: diagnostic emission plumbing ([`DiagnosticSink`])
18//! - `error`; the crate-level [`CoreError`] and `Result` alias
19//! - `hash`: deterministic content hashing ([`ContentHash`], [`ContentHasher`])
20//! - `path`: portable path helpers ([`display_path`], [`resolve_relative`])
21
22#![doc(
23 html_logo_url = "https://mosaic.kjanat.dev/assets/A4.svg",
24 html_favicon_url = "https://mosaic.kjanat.dev/assets/A4.svg"
25)]
26
27pub mod codes;
28mod diagnostics;
29mod document;
30mod error;
31mod hash;
32mod path;
33mod sink;
34mod span;
35
36pub use codes::{DiagnosticCategory, DiagnosticCode, DiagnosticDef};
37pub use diagnostics::{Diagnostic, DiagnosticAnnotation, Severity, Suggestion};
38pub use document::{AttrMap, AttrValue, Document, Node, NodeId, NodeKind, NodeSpec, StyleId};
39pub use error::{CoreError, Result};
40pub use hash::{ContentHash, ContentHasher};
41pub use path::{PathError, display_path, resolve_relative, resolve_source_path};
42pub use sink::{CollectingSink, DiagnosticAbort, DiagnosticResult, DiagnosticSink};
43pub use span::{SourceSpan, linecol};