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.

Source

Content::equal

fn Content::equal(Content, Content) -> Bool

Source

Content::not_equal

fn Content::not_equal(x : Content, y : Content) -> Bool

Source

Content::to_repr

fn Content::to_repr(Content) -> @moonbitlang/core/debug.Repr

Source

Conversion

pub struct Conversion {
  tree : @moonrockz/diagrams/data-tree.DataTree?
  diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}

The result of converting a document to a data tree.

Source

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.

Source

Document::equal

fn Document::equal(Document, Document) -> Bool

Source

Document::logical_equal

fn Document::logical_equal(self : Document, other : Document) -> Bool

Compare two documents without spans and source spellings.

Source

Document::new

fn Document::new(lines : ArrayView[Line], name? : String, statements? : ArrayView[@moonrockz/diagrams-plantuml/envelope.Statement], highlights? : ArrayView[@moonrockz/diagrams-plantuml/data.Selector]) -> Document

A document. The constructor copies its arrays.

Source

Document::not_equal

fn Document::not_equal(x : Document, y : Document) -> Bool

Source

Document::to_repr

fn Document::to_repr(Document) -> @moonbitlang/core/debug.Repr

Source

Entry

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.

Source

Entry::equal

fn Entry::equal(Entry, Entry) -> Bool

Source

Entry::not_equal

fn Entry::not_equal(x : Entry, y : Entry) -> Bool

Source

Entry::to_repr

fn Entry::to_repr(Entry) -> @moonbitlang/core/debug.Repr

Source

Line

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 - .

Source

Line::equal

fn Line::equal(Line, Line) -> Bool

Source

Line::logical_equal

fn Line::logical_equal(self : Line, other : Line) -> Bool

Compare two lines without spans and source spellings.

Source

Line::native_indent

fn Line::native_indent(self : Line) -> Int

The indentation that the native profile compares: the column after - for a list item, one more than the dash for a lone -.

Source

Line::new

fn Line::new(indent : Int, content : Content) -> Line

Source

Line::not_equal

fn Line::not_equal(x : Line, y : Line) -> Bool

Source

Line::to_repr

fn Line::to_repr(Line) -> @moonbitlang/core/debug.Repr

Source

ReadResult

pub struct ReadResult {
  nodes : Array[@moonrockz/diagrams-plantuml/cst.Node]
  document : Document?
  diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}

The result of reading a YAML body.

Source

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.

Source

Scalar::equal

fn Scalar::equal(Scalar, Scalar) -> Bool

Source

Scalar::new

fn Scalar::new(text : String) -> Scalar

Source

Scalar::not_equal

fn Scalar::not_equal(x : Scalar, y : Scalar) -> Bool

Source

Scalar::to_repr

fn Scalar::to_repr(Scalar) -> @moonbitlang/core/debug.Repr

Source

Values

diagnostic_codes

let diagnostic_codes : ReadOnlyArray[String]

The stable diagnostic codes of the YAML reader, writer and converter.

Source

java_trim

fn java_trim(text : String) -> String

The text without leading and trailing code units up to U+0020, as Java String.trim gives.

Source

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.

Source

read

fn read(scan : @moonrockz/diagrams-plantuml/envelope.Scan, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ReadResult

Read 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.

Source

to_data_tree

fn to_data_tree(document : Document, id? : String, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> Conversion

Convert 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.

Source