moonrockz/diagrams-plantuml/regex

Types

Conversion

pub struct Conversion {
  regex : @moonrockz/diagrams/regex.Regex?
  diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}

Source

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.

Source

Document::equal

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

Source

Document::logical_equal

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

True when two documents have equal logical content. Source locations, source spelling and trivia are not compared.

Source

Document::new

fn Document::new(pattern : Expr, name? : String, statements? : ArrayView[@moonrockz/diagrams-plantuml/envelope.Statement], text? : String) -> Document

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

Document::without_spans

fn Document::without_spans(self : Document) -> Document

The document without source locations and source spelling.

Source

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.

Source

Expr::equal

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

Source

Expr::not_equal

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

Source

Expr::to_repr

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

Source

Expr::without_spans

fn Expr::without_spans(self : Expr) -> Expr

The expression without source locations, for logical comparison.

Source

ReadResult

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

Source

Values

diagnostic_codes

let diagnostic_codes : ReadOnlyArray[String]

The stable diagnostic codes of the regex reader and writer.

Source

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.

Source

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.

Source

read

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

Read the body of a scanned regex block. The block has exactly one pattern line; further pattern lines are an error.

Source

to_regex

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

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

Source