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.
Activation::equal
fn Activation::equal(Activation, Activation) -> BoolActivation::not_equal
fn Activation::not_equal(x : Activation, y : Activation) -> BoolActivation::to_repr
fn Activation::to_repr(Activation) -> @moonbitlang/core/debug.ReprAutonumber
pub(all) enum Autonumber {
On(start~ : String?, step~ : String?)
Off
} derive(Eq, @moonbitlang/core/debug.Debug)An autonumber statement. The numbers keep their spelling.
Autonumber::equal
fn Autonumber::equal(Autonumber, Autonumber) -> BoolAutonumber::not_equal
fn Autonumber::not_equal(x : Autonumber, y : Autonumber) -> BoolAutonumber::to_repr
fn Autonumber::to_repr(Autonumber) -> @moonbitlang/core/debug.ReprBox
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.
Box::equal
fn Box::equal(Box, Box) -> BoolBox::not_equal
fn Box::not_equal(x : Box, y : Box) -> BoolBox::to_repr
fn Box::to_repr(Box) -> @moonbitlang/core/debug.ReprDiagram
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.
Diagram::equal
fn Diagram::equal(Diagram, Diagram) -> BoolDiagram::new
fn Diagram::new(statements : ArrayView[Statement], front_matter? : String, directives? : ArrayView[String]) -> DiagramA diagram with copies of statements and directives.
Diagram::not_equal
fn Diagram::not_equal(x : Diagram, y : Diagram) -> BoolDiagram::to_repr
fn Diagram::to_repr(Diagram) -> @moonbitlang/core/debug.ReprFrame
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.
Frame::equal
fn Frame::equal(Frame, Frame) -> BoolFrame::not_equal
fn Frame::not_equal(x : Frame, y : Frame) -> BoolFrame::to_repr
fn Frame::to_repr(Frame) -> @moonbitlang/core/debug.ReprFrameKind
pub(all) enum FrameKind {
Loop
Rect
Opt
Alt
Par
ParOver
Critical
Break
} derive(Eq, @moonbitlang/core/debug.Debug)The kind of a frame.
FrameKind::equal
fn FrameKind::equal(FrameKind, FrameKind) -> BoolFrameKind::not_equal
fn FrameKind::not_equal(x : FrameKind, y : FrameKind) -> BoolFrameKind::to_repr
fn FrameKind::to_repr(FrameKind) -> @moonbitlang/core/debug.ReprLinkKind
pub(all) enum LinkKind {
Link
Links
Properties
Details
} derive(Eq, @moonbitlang/core/debug.Debug)The keyword of a link-like statement.
LinkKind::equal
fn LinkKind::equal(LinkKind, LinkKind) -> BoolLinkKind::not_equal
fn LinkKind::not_equal(x : LinkKind, y : LinkKind) -> BoolLinkKind::to_repr
fn LinkKind::to_repr(LinkKind) -> @moonbitlang/core/debug.ReprLinkStatement
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.
LinkStatement::equal
fn LinkStatement::equal(LinkStatement, LinkStatement) -> BoolLinkStatement::not_equal
fn LinkStatement::not_equal(x : LinkStatement, y : LinkStatement) -> BoolLinkStatement::to_repr
fn LinkStatement::to_repr(LinkStatement) -> @moonbitlang/core/debug.ReprMessageStatement
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.
MessageStatement::equal
fn MessageStatement::equal(MessageStatement, MessageStatement) -> BoolMessageStatement::not_equal
fn MessageStatement::not_equal(x : MessageStatement, y : MessageStatement) -> BoolMessageStatement::to_repr
fn MessageStatement::to_repr(MessageStatement) -> @moonbitlang/core/debug.ReprNoteStatement
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.
NoteStatement::equal
fn NoteStatement::equal(NoteStatement, NoteStatement) -> BoolNoteStatement::not_equal
fn NoteStatement::not_equal(x : NoteStatement, y : NoteStatement) -> BoolNoteStatement::to_repr
fn NoteStatement::to_repr(NoteStatement) -> @moonbitlang/core/debug.ReprParticipantDecl
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.
ParticipantDecl::equal
fn ParticipantDecl::equal(ParticipantDecl, ParticipantDecl) -> BoolParticipantDecl::not_equal
fn ParticipantDecl::not_equal(x : ParticipantDecl, y : ParticipantDecl) -> BoolParticipantDecl::to_repr
fn ParticipantDecl::to_repr(ParticipantDecl) -> @moonbitlang/core/debug.ReprParticipantKeyword
pub(all) enum ParticipantKeyword {
Participant
Actor
} derive(Eq, @moonbitlang/core/debug.Debug)The keyword of a participant declaration.
ParticipantKeyword::equal
fn ParticipantKeyword::equal(ParticipantKeyword, ParticipantKeyword) -> BoolParticipantKeyword::not_equal
fn ParticipantKeyword::not_equal(x : ParticipantKeyword, y : ParticipantKeyword) -> BoolParticipantKeyword::to_repr
fn ParticipantKeyword::to_repr(ParticipantKeyword) -> @moonbitlang/core/debug.ReprPlacement
pub(all) enum Placement {
LeftOf
RightOf
Over
} derive(Eq, @moonbitlang/core/debug.Debug)Where a note is.
Placement::equal
fn Placement::equal(Placement, Placement) -> BoolPlacement::not_equal
fn Placement::not_equal(x : Placement, y : Placement) -> BoolPlacement::to_repr
fn Placement::to_repr(Placement) -> @moonbitlang/core/debug.ReprSection
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.
Section::equal
fn Section::equal(Section, Section) -> BoolSection::not_equal
fn Section::not_equal(x : Section, y : Section) -> BoolSection::to_repr
fn Section::to_repr(Section) -> @moonbitlang/core/debug.ReprStatement
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.
Statement::equal
fn Statement::equal(a : Statement, b : Statement) -> BoolStatement::not_equal
fn Statement::not_equal(x : Statement, y : Statement) -> BoolStatement::to_repr
fn Statement::to_repr(Statement) -> @moonbitlang/core/debug.Reprimpl Eq for Statement
Eq::equal
fn equal(a : Statement, b : Statement) -> BoolStatementKind
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.
StatementKind::equal
fn StatementKind::equal(StatementKind, StatementKind) -> BoolStatementKind::not_equal
fn StatementKind::not_equal(x : StatementKind, y : StatementKind) -> BoolStatementKind::to_repr
fn StatementKind::to_repr(StatementKind) -> @moonbitlang/core/debug.ReprValues
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.