moonrockz/diagrams-plantuml/ebnf
Types
Conversion
pub struct Conversion {
grammar : @moonrockz/diagrams/ebnf.Grammar?
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}Document
pub struct Document {
name : String?
statements : ReadOnlyArray[@moonrockz/diagrams-plantuml/envelope.Statement]
items : ReadOnlyArray[Item]
} derive(Eq, @moonbitlang/core/debug.Debug)Document::equal
fn Document::equal(Document, Document) -> BoolDocument::logical_equal
fn Document::logical_equal(self : Document, other : Document) -> BoolDocument::new
fn Document::new(items : ArrayView[Item], name? : String, statements? : ArrayView[@moonrockz/diagrams-plantuml/envelope.Statement]) -> 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) -> DocumentExpr
pub(all) enum Expr {
Terminal(String, @moonrockz/diagrams/ebnf.Quote, Notes, @moonrockz/diagrams.Span?)
Name(String, Notes, @moonrockz/diagrams.Span?)
Special(String, Notes, @moonrockz/diagrams.Span?)
Concat(ReadOnlyArray[Expr])
Alt(ReadOnlyArray[Expr])
Optional(Expr, @moonrockz/diagrams.Span?)
ZeroOrMore(Expr, @moonrockz/diagrams.Span?)
OneOrMore(Expr, @moonrockz/diagrams.Span?)
Count(String, Expr, @moonrockz/diagrams.Span?)
Not(Expr, @moonrockz/diagrams.Span?)
} derive(Eq, @moonbitlang/core/debug.Debug)One typed EBNF expression. Concatenations and alternations are flat. Grouping parentheses are syntax only; the tree records the structure.
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) -> ExprItem
pub(all) enum Item {
Rule(Rule)
Note(ReadOnlyArray[String], @moonrockz/diagrams.Span?)
} derive(Eq, @moonbitlang/core/debug.Debug)Item::equal
fn Item::equal(Item, Item) -> BoolItem::not_equal
fn Item::not_equal(x : Item, y : Item) -> BoolItem::to_repr
fn Item::to_repr(Item) -> @moonbitlang/core/debug.ReprNotes
pub struct Notes {
above : String?
below : String?
} derive(Eq, @moonbitlang/core/debug.Debug)The note above and the note below a leaf term.
Notes::equal
fn Notes::equal(Notes, Notes) -> BoolNotes::not_equal
fn Notes::not_equal(x : Notes, y : Notes) -> BoolNotes::to_repr
fn Notes::to_repr(Notes) -> @moonbitlang/core/debug.ReprReadResult
pub struct ReadResult {
nodes : Array[@moonrockz/diagrams-plantuml/cst.Node]
document : Document?
diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}Rule
pub struct Rule {
name : String
body : Expr?
above : String?
below : String?
span : @moonrockz/diagrams.Span?
} derive(Eq, @moonbitlang/core/debug.Debug)Rule::equal
fn Rule::equal(Rule, Rule) -> BoolRule::new
fn Rule::new(name : String, body? : Expr, above? : String, below? : String) -> RuleA rule from typed values, without a source location.
Rule::not_equal
fn Rule::not_equal(x : Rule, y : Rule) -> BoolRule::to_repr
fn Rule::to_repr(Rule) -> @moonbitlang/core/debug.ReprValues
diagnostic_codes
let diagnostic_codes : ReadOnlyArray[String]The stable diagnostic codes of the EBNF reader and writer.
no_note
let no_note : Notesprint_body
fn print_body(document : Document, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> Result[String, ReadOnlyArray[@moonrockz/diagrams.Diagnostic]]The canonical body of an EBNF document: one line per rule and per note line, derived from typed values.
read
fn read(scan : @moonrockz/diagrams-plantuml/envelope.Scan, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ReadResultRead the body of a scanned EBNF block. Statements dispatch in the order of the pinned reader: whole-line notes, multi-line notes, single-line rules and multi-line rules. A rule that PlantUML draws as "Syntax error!" is an error here.
to_grammar
fn to_grammar(document : Document, id? : String, limits? : @moonrockz/diagrams-plantuml/envelope.Limits) -> ConversionConvert an EBNF document to the format-independent grammar model. Names stay symbolic references; recursive rules are never expanded. An exclusion constrains the term before it and is never an alternative.