Skip to main content

Crate praxis_source

Crate praxis_source 

Source
Expand description

Source files, spans, line maps, and diagnostics for the Praxis compiler.

This is the leaf crate of the workspace: every other compiler crate reads source through SourceMap and reports problems as Diagnostics. The types here are designed so that illegal states are unrepresentable — an inverted span, an orphan span without a file, or a diagnostic without a primary span cannot be constructed through the public API.

See docs/technical-design.md §14.1 (praxis-source responsibilities) and §8 (diagnostic format).

Re-exports§

pub use diagnostic::DiagCode;
pub use diagnostic::Diagnostic;
pub use diagnostic::DiagnosticCategory;
pub use diagnostic::DiagnosticCode;
pub use diagnostic::DiagnosticNote;
pub use diagnostic::Renderer;
pub use diagnostic::Severity;
pub use diagnostic::Suggestion;
pub use diagnostic::render_one;
pub use file::FileId;
pub use file::SourceFile;
pub use file::SourceMap;
pub use line_map::LineCol;
pub use line_map::LineMap;
pub use span::BytePos;
pub use span::FileSpan;
pub use span::Span;
pub use suggest::nearest;

Modules§

diagnostic
Diagnostics: structured problems reported against source spans.
file
Source files and the SourceMap that interns them.
line_map
Line/column mapping for a source file.
snippet
Shared source-snippet rendering: the path:line:col header, the numbered source line(s) a span touches, and a caret underline.
span
Source spans.
style
Terminal styling: a tiny, dependency-free ANSI palette.
suggest
“Did you mean …?” — one rule for the whole compiler (ADR-132).