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.
Segment
pub(all) enum Segment {
Name(String)
Occurrence(String, Int)
Any
Deep
} derive(Eq, @moonbitlang/core/debug.Debug)One segment of a #highlight path.
Segment::equal
fn Segment::equal(Segment, Segment) -> BoolSegment::not_equal
fn Segment::not_equal(x : Segment, y : Segment) -> BoolSegment::to_repr
fn Segment::to_repr(Segment) -> @moonbitlang/core/debug.ReprSelector
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.
Selector::equal
fn Selector::equal(Selector, Selector) -> BoolSelector::is_plain
fn Selector::is_plain(self : Selector) -> BoolTrue when the selector has no wildcard and no occurrence number.
Selector::logical_equal
fn Selector::logical_equal(self : Selector, other : Selector) -> BoolEquality without the source span.
Selector::new
fn Selector::new(segments : ArrayView[Segment], stereotype? : String, span? : @moonrockz/diagrams.Span) -> SelectorA selector. The constructor copies segments.
Selector::not_equal
fn Selector::not_equal(x : Selector, y : Selector) -> BoolSelector::to_line
fn Selector::to_line(self : Selector) -> StringThe canonical source line of the selector, without a line break. Names
are quoted, so /, * and < in a name stay literal.
Selector::to_repr
fn Selector::to_repr(Selector) -> @moonbitlang/core/debug.ReprValues
is_highlight_line
fn is_highlight_line(text : String) -> BoolTrue when the trimmed line is a #highlight statement.
member_id
fn member_id(path : ArrayView[Int]) -> StringThe identity of the member occurrence at an ownership path, for example
m/0/2. Member identities never use names or scalar text.
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.
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.
resolve
fn resolve(tree : @moonrockz/diagrams/data-tree.DataTree, selectors : ArrayView[Selector], prefix : String, work_limit? : Int) -> ResolutionResolve 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.
value_id
fn value_id(path : ArrayView[Int]) -> StringThe 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.