moonrockz/diagrams-plantuml/yaml
Types
Content
pub(all) enum Content {
Dash
Item(Scalar)
Text(Scalar)
Pair(Bool, Scalar, Entry)
} derive(Eq, @moonbitlang/core/debug.Debug)The content of one native YAML line.
Content::equal
fn Content::equal(Content, Content) -> BoolContent::not_equal
fn Content::not_equal(x : Content, y : Content) -> BoolContent::to_repr
fn Content::to_repr(Content) -> @moonbitlang/core/debug.ReprConversion
pub struct Conversion {
tree : @moonrockz/diagrams/data-tree.DataTree?
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}The result of converting a document to a data tree.
Document
pub struct Document {
name : String?
statements : ReadOnlyArray[@moonrockz/diagrams-plantuml/envelope.Statement]
highlights : ReadOnlyArray[@moonrockz/diagrams-plantuml/data.Selector]
lines : ReadOnlyArray[Line]
} derive(Eq, @moonbitlang/core/debug.Debug)One parsed YAML diagram block: the native line forms in source order.
Comment-only and blank lines are trivia; block content lines belong to
their key: | line.
Document::equal
fn Document::equal(Document, Document) -> BoolDocument::logical_equal
fn Document::logical_equal(self : Document, other : Document) -> BoolCompare two documents without spans and source spellings.
Document::new
fn Document::new(lines : ArrayView[Line], name? : String, statements? : ArrayView[@moonrockz/diagrams-plantuml/envelope.Statement], highlights? : ArrayView[@moonrockz/diagrams-plantuml/data.Selector]) -> DocumentA document. The constructor copies its arrays.
Document::not_equal
fn Document::not_equal(x : Document, y : Document) -> BoolDocument::to_repr
fn Document::to_repr(Document) -> @moonbitlang/core/debug.ReprEntry
pub(all) enum Entry {
Empty
Value(Scalar)
Flow(ReadOnlyArray[String])
Block(ReadOnlyArray[String])
Folded
} derive(Eq, @moonbitlang/core/debug.Debug)The part of a key: line after the colon.
Entry::equal
fn Entry::equal(Entry, Entry) -> BoolEntry::not_equal
fn Entry::not_equal(x : Entry, y : Entry) -> BoolEntry::to_repr
fn Entry::to_repr(Entry) -> @moonbitlang/core/debug.ReprLine
pub struct Line {
indent : Int
content : Content
span : @moonrockz/diagrams.Span?
} derive(Eq, @moonbitlang/core/debug.Debug)One native YAML line. indent is the number of leading spaces, with a
tab counted as four spaces, before any - .
Line::equal
fn Line::equal(Line, Line) -> BoolLine::logical_equal
fn Line::logical_equal(self : Line, other : Line) -> BoolCompare two lines without spans and source spellings.
Line::native_indent
fn Line::native_indent(self : Line) -> IntThe indentation that the native profile compares: the column after -
for a list item, one more than the dash for a lone -.
Line::new
fn Line::new(indent : Int, content : Content) -> LineLine::not_equal
fn Line::not_equal(x : Line, y : Line) -> BoolLine::to_repr
fn Line::to_repr(Line) -> @moonbitlang/core/debug.ReprReadResult
pub struct ReadResult {
nodes : Array[@moonrockz/diagrams-plantuml/cst.Node]
document : Document?
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}The result of reading a YAML body.
Scalar
pub struct Scalar {
text : String
raw : String?
} derive(Eq, @moonbitlang/core/debug.Debug)A scalar of the native YAML profile. text is the value after the
profile removes one pair of matching outer quotes; there is no escape
processing. raw is the source spelling, or None for a constructed
value. Logical comparison and canonical writing use only text.
Scalar::equal
fn Scalar::equal(Scalar, Scalar) -> BoolScalar::new
fn Scalar::new(text : String) -> ScalarScalar::not_equal
fn Scalar::not_equal(x : Scalar, y : Scalar) -> BoolScalar::to_repr
fn Scalar::to_repr(Scalar) -> @moonbitlang/core/debug.ReprValues
diagnostic_codes
let diagnostic_codes : ReadOnlyArray[String]The stable diagnostic codes of the YAML reader, writer and converter.
java_trim
fn java_trim(text : String) -> StringThe text without leading and trailing code units up to U+0020, as Java
String.trim gives.
print_body
fn print_body(document : Document, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> Result[String, ReadOnlyArray[@moonrockz/diagrams.Diagnostic]]Write the canonical body of a YAML block from the typed lines: one
#highlight line for each selector, then each line with its indentation,
the first scalar spelling that reads back to the same value, and no
comments or blank lines. Every line ends with a line break. The text has
no block markers and no shared statements. A value that the native
profile cannot express gives an error; there is no partial output and
no source fallback.
read
fn read(scan : @moonrockz/diagrams-plantuml/envelope.Scan, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ReadResultRead the YAML body of a scanned block with the pinned native line rules.
Reading keeps every line form, including forms that conversion refuses,
such as folded text. A key: | line takes the following lines that are
text, comments or deeper than the key; blank lines are not content, as
upstream removes them before the YAML parser runs. Tabs count as four
spaces. Comments are # outside quotes, or # at the start.
to_data_tree
fn to_data_tree(document : Document, id? : String, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ConversionConvert a YAML document to a structured-data model with the scalar policy
of PlantUML 1.2026.9: every scalar is text, so enabled: true gives the
text true. Anchors, aliases and tags stay literal text. A repeated key
keeps the last value at the first position, with a warning; the document
keeps every occurrence. Input that the pinned profile refuses gives an
error and no tree. Identities come from ordered ownership paths, as in
the JSON converter. The title is the last title statement.