moonrockz/diagrams-plantuml/cst
Types
Element
pub(all) enum Element {
Token(Token)
Node(Node)
} derive(Eq, @moonbitlang/core/debug.Debug)Element::equal
fn Element::equal(Element, Element) -> BoolElement::not_equal
fn Element::not_equal(x : Element, y : Element) -> BoolElement::to_repr
fn Element::to_repr(Element) -> @moonbitlang/core/debug.ReprLines
pub struct Lines {
// private fields
}A line index of a source text for UTF-16 positions.
Lines::new
fn Lines::new(source : String) -> LinesLines::position
fn Lines::position(self : Lines, offset : Int) -> @moonrockz/diagrams.PositionThe position of a UTF-16 offset. Lines and columns start at 1; columns count UTF-16 code units. A CR before LF belongs to its line.
Lines::span
fn Lines::span(self : Lines, start : Int, end : Int) -> @moonrockz/diagrams.SpanNode
pub struct Node {
kind : NodeKind
children : ReadOnlyArray[Element]
} derive(Eq, @moonbitlang/core/debug.Debug)A node of the lossless syntax tree.
Node::equal
fn Node::equal(Node, Node) -> BoolNode::new
fn Node::new(kind : NodeKind, children : ArrayView[Element]) -> NodeNode::nodes
fn Node::nodes(self : Node) -> Array[Node]The child nodes of the node.
Node::not_equal
fn Node::not_equal(x : Node, y : Node) -> BoolNode::range
fn Node::range(self : Node) -> (Int, Int)?The half-open UTF-16 range of the node, or None for an empty node.
Node::text
fn Node::text(self : Node) -> StringThe source text of the node.
Node::to_repr
fn Node::to_repr(Node) -> @moonbitlang/core/debug.ReprNode::tokens
fn Node::tokens(self : Node) -> Array[Token]All tokens of the node in source order, without recursion.
NodeKind
pub(all) enum NodeKind {
Document
Start
End
Title
Caption
Header
Footer
Legend
Skinparam
Style
Pragma
Scale
Hide
Comment
Directive
Highlight
Pattern
Rule
Note
Data
Blank
Trailing
Error
} derive(Eq, @moonbitlang/core/debug.Debug)The kind of a node. Each source line, or each multi-line statement, is one node under the document.
NodeKind::equal
fn NodeKind::equal(NodeKind, NodeKind) -> BoolNodeKind::not_equal
fn NodeKind::not_equal(x : NodeKind, y : NodeKind) -> BoolNodeKind::to_repr
fn NodeKind::to_repr(NodeKind) -> @moonbitlang/core/debug.ReprToken
pub struct Token {
kind : TokenKind
text : String
offset : Int
} derive(Eq, @moonbitlang/core/debug.Debug)One token. offset is the UTF-16 offset of its first code unit in the
source. The concatenated token texts of a tree are equal to the source.
Token::equal
fn Token::equal(Token, Token) -> BoolToken::new
fn Token::new(kind : TokenKind, text : String, offset : Int) -> TokenToken::not_equal
fn Token::not_equal(x : Token, y : Token) -> BoolToken::to_repr
fn Token::to_repr(Token) -> @moonbitlang/core/debug.ReprTokenKind
pub(all) enum TokenKind {
Marker
Keyword
Name
Text
String
Number
Literal
Escape
Operator
Punctuation
Comment
Whitespace
Newline
Directive
Error
} derive(Eq, @moonbitlang/core/debug.Debug)The kind of a token in the lossless syntax tree. All four body languages share these kinds.
TokenKind::equal
fn TokenKind::equal(TokenKind, TokenKind) -> BoolTokenKind::not_equal
fn TokenKind::not_equal(x : TokenKind, y : TokenKind) -> BoolTokenKind::to_repr
fn TokenKind::to_repr(TokenKind) -> @moonbitlang/core/debug.ReprValues
slice
fn slice(text : String, start : Int, end : Int) -> StringThe owned text of the half-open UTF-16 range start to end of text.
span
fn span(source : String, start : Int, end : Int) -> @moonrockz/diagrams.SpanThe span of a half-open UTF-16 range of source.