moonrockz/diagrams-mermaid/ast

Types

Activation

pub(all) enum Activation {
  Activate
  Deactivate
} derive(Eq, @moonbitlang/core/debug.Debug)

The activation shorthand of a message: + or - after the arrow.

Source

Activation::equal

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

Source

Activation::not_equal

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

Source

Activation::to_repr

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

Source

Autonumber

pub(all) enum Autonumber {
  On(start~ : String?, step~ : String?)
  Off
} derive(Eq, @moonbitlang/core/debug.Debug)

An autonumber statement. The numbers keep their spelling.

Source

Autonumber::equal

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

Source

Autonumber::not_equal

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

Source

Autonumber::to_repr

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

Source

Box

pub(all) struct Box {
  label : String
  statements : ReadOnlyArray[Statement]
} derive(Eq, @moonbitlang/core/debug.Debug)

A box group: the text after box and the participant statements in it.

Source

Box::equal

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

Source

Box::not_equal

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

Source

Box::to_repr

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

Source

Diagram

pub(all) struct Diagram {
  front_matter : String?
  directives : ReadOnlyArray[String]
  statements : ReadOnlyArray[Statement]
} derive(Eq, @moonbitlang/core/debug.Debug)

The typed AST of a Mermaid sequence diagram. front_matter is the front matter block with its --- lines. directives are the %%{...}%% directives in source order. Comments are not in the AST.

Source

Diagram::equal

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

Source

Diagram::new

fn Diagram::new(statements : ArrayView[Statement], front_matter? : String, directives? : ArrayView[String]) -> Diagram

A diagram with copies of statements and directives.

Source

Diagram::not_equal

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

Source

Diagram::to_repr

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

Source

Frame

pub(all) struct Frame {
  kind : FrameKind
  sections : ReadOnlyArray[Section]
} derive(Eq, @moonbitlang/core/debug.Debug)

A frame such as loop, alt or rect, with one or more sections.

Source

Frame::equal

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

Source

Frame::not_equal

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

Source

Frame::to_repr

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

Source

FrameKind

pub(all) enum FrameKind {
  Loop
  Rect
  Opt
  Alt
  Par
  ParOver
  Critical
  Break
} derive(Eq, @moonbitlang/core/debug.Debug)

The kind of a frame.

Source

FrameKind::equal

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

Source

FrameKind::not_equal

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

Source

FrameKind::to_repr

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

Source

LinkKind

pub(all) enum LinkKind {
  Link
  Links
  Properties
  Details
} derive(Eq, @moonbitlang/core/debug.Debug)

The keyword of a link-like statement.

Source

LinkKind::equal

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

Source

LinkKind::not_equal

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

Source

LinkKind::to_repr

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

Source

LinkStatement

pub(all) struct LinkStatement {
  kind : LinkKind
  participant : String
  text : String
} derive(Eq, @moonbitlang/core/debug.Debug)

A link, links, properties or details statement. text is the text after : as written, for example JSON for links.

Source

LinkStatement::equal

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

Source

LinkStatement::not_equal

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

Source

LinkStatement::to_repr

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

Source

MessageStatement

pub(all) struct MessageStatement {
  sender : String
  arrow : String
  receiver : String
  text : String
  activation : Activation?
  central_before : Bool
  central_after : Bool
} derive(Eq, @moonbitlang/core/debug.Debug)

A message statement. arrow keeps the exact spelling of the source, and text has no spaces at its ends. central_before and central_after are the () central connection markers before and after the arrow.

Source

MessageStatement::equal

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

Source

MessageStatement::not_equal

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

Source

MessageStatement::to_repr

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

Source

NoteStatement

pub(all) struct NoteStatement {
  placement : Placement
  participants : ReadOnlyArray[String]
  text : String
} derive(Eq, @moonbitlang/core/debug.Debug)

A note on one participant, or over one or two participants.

Source

NoteStatement::equal

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

Source

NoteStatement::not_equal

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

Source

NoteStatement::to_repr

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

Source

ParticipantDecl

pub(all) struct ParticipantDecl {
  created : Bool
  keyword : ParticipantKeyword
  id : String
  config : String?
  label : String?
} derive(Eq, @moonbitlang/core/debug.Debug)

A participant or actor statement. created is true for the create form. config is the text inside @{...} without the spaces at its ends.

Source

ParticipantDecl::equal

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

Source

ParticipantDecl::not_equal

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

Source

ParticipantDecl::to_repr

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

Source

ParticipantKeyword

pub(all) enum ParticipantKeyword {
  Participant
  Actor
} derive(Eq, @moonbitlang/core/debug.Debug)

The keyword of a participant declaration.

Source

ParticipantKeyword::equal

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

Source

ParticipantKeyword::not_equal

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

Source

ParticipantKeyword::to_repr

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

Source

Placement

pub(all) enum Placement {
  LeftOf
  RightOf
  Over
} derive(Eq, @moonbitlang/core/debug.Debug)

Where a note is.

Source

Placement::equal

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

Source

Placement::not_equal

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

Source

Placement::to_repr

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

Source

Section

pub(all) struct Section {
  label : String
  statements : ReadOnlyArray[Statement]
} derive(Eq, @moonbitlang/core/debug.Debug)

One section of a frame: the text after its keyword and its statements. The first section starts at the frame keyword, and each else, and or option starts another one.

Source

Section::equal

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

Source

Section::not_equal

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

Source

Section::to_repr

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

Source

Statement

pub(all) struct Statement {
  kind : StatementKind
  span : @moonrockz/diagrams.Span
} derive(@moonbitlang/core/debug.Debug)

One statement and its place in the source. Equality does not compare span, so two sources with the same statements have equal ASTs.

Source

Statement::equal

fn Statement::equal(a : Statement, b : Statement) -> Bool

Source

Statement::not_equal

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

Source

Statement::to_repr

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

Source

impl Eq for Statement

Eq::equal

fn equal(a : Statement, b : Statement) -> Bool

Source

StatementKind

pub(all) enum StatementKind {
  Participant(ParticipantDecl)
  Destroy(String)
  Activate(String)
  Deactivate(String)
  Message(MessageStatement)
  Note(NoteStatement)
  Link(LinkStatement)
  Title(String)
  AccTitle(String)
  AccDescr(String)
  Autonumber(Autonumber)
  Frame(Frame)
  Box(Box)
} derive(Eq, @moonbitlang/core/debug.Debug)

What a statement says.

Source

StatementKind::equal

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

Source

StatementKind::not_equal

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

Source

StatementKind::to_repr

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

Source

Values

lower

fn lower(tree : @moonrockz/diagrams-mermaid/cst.Node) -> Diagram?

The typed AST of a lossless syntax tree. Error nodes are not in the AST, because the parser already reported them. A tree without the sequenceDiagram header gives None.

Source