moonrockz/diagrams-plantuml/regex
Types
Conversion
pub struct Conversion {
regex : @moonrockz/diagrams/regex.Regex?
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}Document
pub struct Document {
name : String?
statements : ReadOnlyArray[@moonrockz/diagrams-plantuml/envelope.Statement]
pattern : Expr
text : String
span : @moonrockz/diagrams.Span?
} derive(Eq, @moonbitlang/core/debug.Debug)One parsed regex block.
Document::equal
fn Document::equal(Document, Document) -> BoolDocument::logical_equal
fn Document::logical_equal(self : Document, other : Document) -> BoolTrue when two documents have equal logical content. Source locations, source spelling and trivia are not compared.
Document::new
fn Document::new(pattern : Expr, name? : String, statements? : ArrayView[@moonrockz/diagrams-plantuml/envelope.Statement], text? : String) -> DocumentDocument::not_equal
fn Document::not_equal(x : Document, y : Document) -> BoolDocument::to_repr
fn Document::to_repr(Document) -> @moonbitlang/core/debug.ReprDocument::without_spans
fn Document::without_spans(self : Document) -> DocumentThe document without source locations and source spelling.
Expr
pub(all) enum Expr {
Char(String, Bool, @moonrockz/diagrams.Span?)
Class(@moonrockz/diagrams/regex.ClassKind, @moonrockz/diagrams.Span?)
Backreference(String, @moonrockz/diagrams.Span?)
Set(Bool, ReadOnlyArray[@moonrockz/diagrams/regex.SetItem], @moonrockz/diagrams.Span?)
Anchor(@moonrockz/diagrams/regex.AnchorKind, @moonrockz/diagrams.Span?)
Concat(ReadOnlyArray[Expr])
Alt(ReadOnlyArray[Expr])
Group(@moonrockz/diagrams/regex.GroupKind, Expr, @moonrockz/diagrams.Span?)
Look(@moonrockz/diagrams/regex.Look, Bool, Expr, @moonrockz/diagrams.Span?)
Quantified(Expr, @moonrockz/diagrams/regex.Bounds, @moonrockz/diagrams.Span?)
} derive(Eq, @moonbitlang/core/debug.Debug)One typed regex expression. Composite nodes are flat: a concatenation never holds another concatenation directly, and an alternation never holds another alternation directly.
Expr::equal
fn Expr::equal(Expr, Expr) -> BoolExpr::not_equal
fn Expr::not_equal(x : Expr, y : Expr) -> BoolExpr::to_repr
fn Expr::to_repr(Expr) -> @moonbitlang/core/debug.ReprExpr::without_spans
fn Expr::without_spans(self : Expr) -> ExprThe expression without source locations, for logical comparison.
ReadResult
pub struct ReadResult {
nodes : Array[@moonrockz/diagrams-plantuml/cst.Node]
document : Document?
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}Values
diagnostic_codes
let diagnostic_codes : ReadOnlyArray[String]The stable diagnostic codes of the regex reader and writer.
print_body
fn print_body(document : Document, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> Result[String, ReadOnlyArray[@moonrockz/diagrams.Diagnostic]]The canonical body of a regex document: one pattern line with a line break.
print_pattern
fn print_pattern(expr : Expr, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> Result[String, ReadOnlyArray[@moonrockz/diagrams.Diagnostic]]Write a pattern from typed values. An expression that the reader cannot read back to the same value gives a diagnostic instead of text.
read
fn read(scan : @moonrockz/diagrams-plantuml/envelope.Scan, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ReadResultRead the body of a scanned regex block. The block has exactly one pattern line; further pattern lines are an error.
to_regex
fn to_regex(document : Document, id? : String, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ConversionConvert a regex document to the format-independent model. Adjacent characters of a concatenation become one literal term, as PlantUML draws them. Node identities are ordered ownership paths, never labels.