Skip to main content

praxis_source/
lib.rs

1//! Source files, spans, line maps, and diagnostics for the Praxis compiler.
2//!
3//! This is the leaf crate of the workspace: every other compiler crate reads
4//! source through `SourceMap` and reports problems as `Diagnostic`s. The types
5//! here are designed so that illegal states are unrepresentable — an inverted
6//! span, an orphan span without a file, or a diagnostic without a primary span
7//! cannot be constructed through the public API.
8//!
9//! See `docs/technical-design.md` §14.1 (`praxis-source` responsibilities)
10//! and §8 (diagnostic format).
11
12pub mod diagnostic;
13pub mod file;
14pub mod line_map;
15pub mod snippet;
16pub mod span;
17pub mod style;
18pub mod suggest;
19
20pub use diagnostic::{
21    DiagCode, Diagnostic, DiagnosticCategory, DiagnosticCode, DiagnosticNote, Renderer, Severity,
22    Suggestion, render_one,
23};
24pub use file::{FileId, SourceFile, SourceMap};
25pub use line_map::{LineCol, LineMap};
26pub use span::{BytePos, FileSpan, Span};
27pub use suggest::nearest;