moonrockz/diagrams
Diagramming for MoonBit. The library will support formats such as Mermaid, PlantUML, Draw.io and Graphviz DOT.
Types
Diagnostic
pub(all) struct Diagnostic {
code : String
severity : Severity
message : String
span : Span?
} derive(Eq, @moonbitlang/core/debug.Debug)A problem that a reader, a converter or a renderer found. code is stable,
for example mermaid/unknown-statement. span is absent when the problem
has no place in a source text.
Diagnostic::equal
fn Diagnostic::equal(Diagnostic, Diagnostic) -> BoolDiagnostic::error
fn Diagnostic::error(code : String, message : String, span? : Span) -> DiagnosticAn error diagnostic.
Diagnostic::not_equal
fn Diagnostic::not_equal(x : Diagnostic, y : Diagnostic) -> BoolDiagnostic::to_repr
fn Diagnostic::to_repr(Diagnostic) -> @moonbitlang/core/debug.ReprDiagnostic::warning
fn Diagnostic::warning(code : String, message : String, span? : Span) -> DiagnosticA warning diagnostic.
Position
pub(all) struct Position {
offset : Int
line : Int
column : Int
} derive(Eq, @moonbitlang/core/debug.Debug)A place in a source text. offset counts UTF-16 code units from the start.
line and column start at 1, and column also counts UTF-16 code units.
Position::equal
fn Position::equal(Position, Position) -> BoolPosition::not_equal
fn Position::not_equal(x : Position, y : Position) -> BoolPosition::to_repr
fn Position::to_repr(Position) -> @moonbitlang/core/debug.ReprSeverity
pub(all) enum Severity {
Error
Warning
Info
} derive(Eq, @moonbitlang/core/debug.Debug)How serious a diagnostic is.
Severity::equal
fn Severity::equal(Severity, Severity) -> BoolSeverity::not_equal
fn Severity::not_equal(x : Severity, y : Severity) -> BoolSeverity::to_repr
fn Severity::to_repr(Severity) -> @moonbitlang/core/debug.ReprSpan
pub(all) struct Span {
start : Position
end : Position
} derive(Eq, @moonbitlang/core/debug.Debug)The half-open range from start to end in a source text.
Span::equal
fn Span::equal(Span, Span) -> BoolSpan::not_equal
fn Span::not_equal(x : Span, y : Span) -> BoolSpan::to_repr
fn Span::to_repr(Span) -> @moonbitlang/core/debug.ReprValues
version
fn version() -> StringThe module version, kept in sync with the root moon.mod.