moonrockz/diagrams-plantuml/data

Types

Resolution

pub struct Resolution {
  highlights : Array[@moonrockz/diagrams/data-tree.Highlight]
  diagnostics : Array[@moonrockz/diagrams.Diagnostic]
  complete : Bool
}

The result of selector resolution.

Source

Segment

pub(all) enum Segment {
  Name(String)
  Occurrence(String, Int)
  Any
  Deep
} derive(Eq, @moonbitlang/core/debug.Debug)

One segment of a #highlight path.

Source

Segment::equal

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

Source

Segment::not_equal

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

Source

Segment::to_repr

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

Source

Selector

pub struct Selector {
  segments : ReadOnlyArray[Segment]
  stereotype : String?
  span : @moonrockz/diagrams.Span?
} derive(Eq, @moonbitlang/core/debug.Debug)

A typed #highlight selector. The stereotype is inert author metadata; library themes paint every highlight.

Source

Selector::equal

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

Source

Selector::is_plain

fn Selector::is_plain(self : Selector) -> Bool

True when the selector has no wildcard and no occurrence number.

Source

Selector::logical_equal

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

Equality without the source span.

Source

Selector::new

fn Selector::new(segments : ArrayView[Segment], stereotype? : String, span? : @moonrockz/diagrams.Span) -> Selector

A selector. The constructor copies segments.

Source

Selector::not_equal

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

Source

Selector::to_line

fn Selector::to_line(self : Selector) -> String

The canonical source line of the selector, without a line break. Names are quoted, so /, * and < in a name stay literal.

Source

Selector::to_repr

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

Source

Values

is_highlight_line

fn is_highlight_line(text : String) -> Bool

True when the trimmed line is a #highlight statement.

Source

member_id

fn member_id(path : ArrayView[Int]) -> String

The identity of the member occurrence at an ownership path, for example m/0/2. Member identities never use names or scalar text.

Source

parse_selector

fn parse_selector(line : String) -> Result[Selector, String]

Parse the text of a #highlight line. A quoted segment keeps /, < and > inside the segment and accepts \", \\ and \* escapes. A quoted * or ** without escapes is a wildcard, as upstream. Upstream PlantUML splits on every / before it removes quotes; this library does not, so a quoted name that contains / selects one member.

Source

read_selectors

fn read_selectors(scan : @moonrockz/diagrams-plantuml/envelope.Scan, prefix : String) -> (Array[Selector], Array[@moonrockz/diagrams.Diagnostic])

Read the selectors of the #highlight statement lines of a scan. A line that does not parse gives an error with the code <prefix>/invalid-highlight.

Source

resolve

fn resolve(tree : @moonrockz/diagrams/data-tree.DataTree, selectors : ArrayView[Selector], prefix : String, work_limit? : Int) -> Resolution

Resolve selectors to member identities of tree, in document order. A selector that selects nothing gives a warning and no highlight. A plain selector that selects more than one member occurrence highlights all of them and gives a warning. A stereotype is kept as inert style metadata and gives a warning that it is not applied. Codes use prefix, for example json/unresolved-highlight.

Source

value_id

fn value_id(path : ArrayView[Int]) -> String

The identity of the value at an ownership path. The root value is v; the value of member 2 of the value of root member 0 is v/0/2.

Source