moonrockz/diagrams-plantuml/envelope
Types
Kind
pub(all) enum Kind {
Regex
Ebnf
Json
Yaml
Activity
State
} derive(Eq, @moonbitlang/core/debug.Debug)The four supported native diagram kinds.
Kind::equal
fn Kind::equal(Kind, Kind) -> BoolKind::not_equal
fn Kind::not_equal(x : Kind, y : Kind) -> BoolKind::to_repr
fn Kind::to_repr(Kind) -> @moonbitlang/core/debug.ReprKind::word
fn Kind::word(self : Kind) -> StringThe marker word of a kind, as in @start<word>.
Limits
pub struct Limits {
source : Int
output : Int
depth : Int
nodes : Int
regions : Int
edges : Int
work : Int
diagnostics : Int
} derive(Eq, @moonbitlang/core/debug.Debug)Explicit positive bounds for reading, writing and conversion.
Limits::equal
fn Limits::equal(Limits, Limits) -> BoolLimits::new
fn Limits::new(source? : Int, output? : Int, depth? : Int, nodes? : Int, regions? : Int, edges? : Int, work? : Int, diagnostics? : Int) -> LimitsLimits::not_equal
fn Limits::not_equal(x : Limits, y : Limits) -> BoolLimits::to_repr
fn Limits::to_repr(Limits) -> @moonbitlang/core/debug.ReprLimits::valid
fn Limits::valid(self : Limits) -> BoolLine
pub struct Line {
number : Int
offset : Int
text : String
newline : String
role : Role
} derive(Eq, @moonbitlang/core/debug.Debug)One source line between the block markers, without its line break.
Line::equal
fn Line::equal(Line, Line) -> BoolLine::not_equal
fn Line::not_equal(x : Line, y : Line) -> BoolLine::to_repr
fn Line::to_repr(Line) -> @moonbitlang/core/debug.ReprLine::tokens
fn Line::tokens(self : Line, kind : @moonrockz/diagrams-plantuml/cst.TokenKind) -> Array[@moonrockz/diagrams-plantuml/cst.Element]The tokens of a line as one text token plus its line break.
Role
pub(all) enum Role {
Body
Statement(@moonrockz/diagrams-plantuml/cst.Node)
Continuation
} derive(Eq, @moonbitlang/core/debug.Debug)The role of one source line inside the block.
Role::equal
fn Role::equal(Role, Role) -> BoolRole::not_equal
fn Role::not_equal(x : Role, y : Role) -> BoolRole::to_repr
fn Role::to_repr(Role) -> @moonbitlang/core/debug.ReprScan
pub struct Scan {
source : String
kind : Kind?
name : String?
head : ReadOnlyArray[@moonrockz/diagrams-plantuml/cst.Node]
lines : ReadOnlyArray[Line]
tail : ReadOnlyArray[@moonrockz/diagrams-plantuml/cst.Node]
statements : ReadOnlyArray[Statement]
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
lines_index : @moonrockz/diagrams-plantuml/cst.Lines
}The scanned envelope of one native block.
Scan::document
fn Scan::document(self : Scan, body : ArrayView[@moonrockz/diagrams-plantuml/cst.Node]) -> @moonrockz/diagrams-plantuml/cst.NodeAssemble the lossless document from the scanned envelope and the nodes that a kind reader made for its body lines.
Scan::line_nodes
fn Scan::line_nodes(self : Scan, make : (Line) -> @moonrockz/diagrams-plantuml/cst.Node?) -> Array[@moonrockz/diagrams-plantuml/cst.Node]The body nodes for lines with the Statement role, and one node per body
line made by make, in source order.
Scan::span
fn Scan::span(self : Scan, start : Int, end : Int) -> @moonrockz/diagrams.SpanScan::title
fn Scan::title(self : Scan) -> String?The title of the block, if it has one. The last title wins.
Statement
pub(all) enum Statement {
Title(String)
Caption(String)
Header(String)
Footer(String)
Legend(ReadOnlyArray[String])
Skinparam(ReadOnlyArray[String])
Style(ReadOnlyArray[String])
Skin(String)
Scale(String)
Hide(String)
Pragma(String)
Option(String)
} derive(Eq, @moonbitlang/core/debug.Debug)One retained presentation or metadata statement. Library themes and options paint the diagram; these values are inert author data.
Statement::equal
fn Statement::equal(Statement, Statement) -> BoolStatement::lines
fn Statement::lines(self : Statement) -> Array[String]The canonical text of a metadata statement, one line per entry, without line breaks at the end.
Statement::not_equal
fn Statement::not_equal(x : Statement, y : Statement) -> BoolStatement::to_repr
fn Statement::to_repr(Statement) -> @moonbitlang/core/debug.ReprValues
diagnostic_codes
let diagnostic_codes : ReadOnlyArray[String]The stable diagnostic codes of envelope scanning.
has_preprocessor_call
fn has_preprocessor_call(text : String) -> BoolTrue when text calls a preprocessor function such as %date().
java_trim
fn java_trim(text : String) -> Stringtext without leading and trailing code units up to U+0020, as Java
String.trim removes them.
kind_of_word
fn kind_of_word(word : String) -> Kind?scan
fn scan(source : String, limits? : Limits) -> ScanScan one native block. Multiple blocks, wrong end markers and text outside the block are errors, never a partial result.
scan_body
fn scan_body(kind : Kind, body : String, limits? : Limits) -> ScanScan a raw body of an explicit kind, without block markers. Every line is
a body line or a shared statement, with offsets into body.
trim
fn trim(text : String) -> Stringtext without leading and trailing spaces, tabs and byte-order marks.