moonrockz/diagrams-plantuml/ebnf

Types

Conversion

pub struct Conversion {
  grammar : @moonrockz/diagrams/ebnf.Grammar?
  diagnostics : ReadOnlyArray[@moonrockz/diagrams.Diagnostic]
}

Source

Document

pub struct Document {
  name : String?
  statements : ReadOnlyArray[@moonrockz/diagrams-plantuml/envelope.Statement]
  items : ReadOnlyArray[Item]
} derive(Eq, @moonbitlang/core/debug.Debug)

Source

Document::equal

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

Source

Document::logical_equal

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

Source

Document::new

fn Document::new(items : ArrayView[Item], name? : String, statements? : ArrayView[@moonrockz/diagrams-plantuml/envelope.Statement]) -> 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

Source

Expr

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.

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

Source

Item

pub(all) enum Item {
  Rule(Rule)
  Note(ReadOnlyArray[String], @moonrockz/diagrams.Span?)
} derive(Eq, @moonbitlang/core/debug.Debug)

Source

Item::equal

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

Source

Item::not_equal

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

Source

Item::to_repr

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

Source

Notes

pub struct Notes {
  above : String?
  below : String?
} derive(Eq, @moonbitlang/core/debug.Debug)

The note above and the note below a leaf term.

Source

Notes::equal

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

Source

Notes::not_equal

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

Source

Notes::to_repr

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

Source

ReadResult

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

Source

Rule

pub struct Rule {
  name : String
  body : Expr?
  above : String?
  below : String?
  span : @moonrockz/diagrams.Span?
} derive(Eq, @moonbitlang/core/debug.Debug)

Source

Rule::equal

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

Source

Rule::new

fn Rule::new(name : String, body? : Expr, above? : String, below? : String) -> Rule

A rule from typed values, without a source location.

Source

Rule::not_equal

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

Source

Rule::to_repr

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

Source

Values

diagnostic_codes

let diagnostic_codes : ReadOnlyArray[String]

The stable diagnostic codes of the EBNF reader and writer.

Source

no_note

let no_note : Notes

Source

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.

Source

read

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

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

Source

to_grammar

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

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

Source