Sign in

    This version of the module is deprecated: Moved to moonbit-community/diago. Use moonbit-community/diago@0.4.0 or later and update import paths.

    Milky2018/diago/ast does not have a README file

    ArrayNode

    pub(all) enum ArrayNode {
    Comment(
    Range
    , String)
    BlockComment(
    Range
    , String)
    Substitution(Substitution)
    Import(Import)
    Value(Value)
    }

    Nodes that can appear inside an array
    impl Eq for ArrayNode
    impl Show for ArrayNode

    ArrayNode::range

    ArrayValue

    pub struct ArrayValue {
    range :
    Range

    nodes : Array[ArrayNode]
    }

    An array value
    impl Eq for ArrayValue
    impl Show for ArrayValue

    ArrayValue::new

    BlockString

    pub struct BlockString {
    range :
    Range

    quote : String
    tag : String
    value : String
    }

    Block string (|md, |sh, etc.)
    impl Eq for BlockString
    impl Show for BlockString

    BlockString::new

    fn BlockString::new(range :
    Range
    , quote : String, tag : String, value : String) -> BlockString

    DoubleQuotedString

    pub struct DoubleQuotedString {
    range :
    Range

    value : Array[Interpolation]
    }

    Double-quoted string that may contain substitutions

    DoubleQuotedString::to_string

    fn DoubleQuotedString::to_string(self : DoubleQuotedString) -> String

    Edge

    pub struct Edge {
    range :
    Range

    src : KeyPath
    src_arrow : String
    dst : KeyPath
    dst_arrow : String
    }

    An edge between two nodes
    impl Eq for Edge
    impl Show for Edge

    Edge::new

    fn Edge::new(range :
    Range
    , src : KeyPath, dst : KeyPath, src_arrow : String, dst_arrow : String) -> Edge

    EdgeIndex

    pub struct EdgeIndex {
    range :
    Range

    index : Int?
    glob : Bool
    }

    Index into an edge group
    impl Eq for EdgeIndex
    impl Show for EdgeIndex

    EdgeIndex::new

    fn EdgeIndex::new(range :
    Range
    , index : Int?, glob : Bool) -> EdgeIndex

    Import

    pub struct Import {
    range :
    Range

    spread : Bool
    pre : String
    path : Array[StringValue]
    }

    Import declaration (@path/to/file)
    impl Eq for Import
    impl Show for Import

    Import::new

    fn Import::new(range :
    Range
    , spread : Bool, pre : String, path : Array[StringValue]) -> Import

    Interpolation

    pub(all) enum Interpolation {
    Text(String)
    Sub(Substitution)
    }

    Part of an interpolated string
    impl Eq for Interpolation

    Key

    pub struct Key {
    range :
    Range

    ampersand : Bool
    not_ampersand : Bool
    key : KeyPath?
    edges : Array[Edge]
    edge_index : EdgeIndex?
    edge_key : KeyPath?
    primary : Scalar?
    value : Value?
    }

    A key declaration in a map

    Examples:
    • x (simple key)
    • x: value (key with value)
    • x -> y (edge)
    • container.child (nested key path)
    • (x -> y).label (edge with property)
    impl Eq for Key
    impl Show for Key

    Key::new

    fn Key::new(range :
    Range
    , ampersand : Bool, not_ampersand : Bool, key : KeyPath?, edges : Array[Edge], edge_index : EdgeIndex?, edge_key : KeyPath?, primary : Scalar?, value : Value?) -> Key

    KeyPath

    pub struct KeyPath {
    range :
    Range

    path : Array[StringValue]
    }

    A path of identifiers separated by dots Example: container.child.grandchild
    impl Eq for KeyPath
    impl Show for KeyPath

    KeyPath::has_glob

    fn KeyPath::has_glob(self : KeyPath) -> Bool

    KeyPath::last

    fn KeyPath::last(self : KeyPath) -> StringValue?

    KeyPath::new

    KeyPath::to_strings

    fn KeyPath::to_strings(self : KeyPath) -> Array[String]

    Map

    pub struct Map {
    range :
    Range

    nodes : Array[MapNode]
    }

    A diago file is represented as a Map at the root level
    impl Eq for Map
    impl Show for Map

    Map::new

    fn Map::new(range :
    Range
    , nodes : Array[MapNode]) -> Map

    MapNode

    pub(all) enum MapNode {
    Comment(
    Range
    , String)
    BlockComment(
    Range
    , String)
    Substitution(Substitution)
    Import(Import)
    Key(Key)
    }

    Nodes that can appear inside a Map
    impl Eq for MapNode
    impl Show for MapNode

    MapNode::range

    Node

    pub(all) enum Node {
    Map(Map)
    MapNode(MapNode)
    Key(Key)
    KeyPath(KeyPath)
    Edge(Edge)
    EdgeIndex(EdgeIndex)
    Value(Value)
    ArrayValue(ArrayValue)
    ArrayNode(ArrayNode)
    Scalar(Scalar)
    StringValue(StringValue)
    UnquotedString(UnquotedString)
    DoubleQuotedString(DoubleQuotedString)
    BlockString(BlockString)
    Substitution(Substitution)
    Import(Import)
    }

    Boxed AST node for generic traversal.

    This is intentionally a closed set of variants over the public AST structs/enums.
    impl Eq for Node
    impl Show for Node

    Node::children

    fn Node::children(self : Node) -> Array[Node]

    Node::node_type

    fn Node::node_type(self : Node) -> String

    Node::range

    Scalar

    Scalar values
    impl Eq for Scalar
    impl Show for Scalar

    Scalar::range

    StringValue

    pub(all) enum StringValue {
    Unquoted(UnquotedString)
    SingleQuoted(
    Range
    , String)
    DoubleQuoted(DoubleQuotedString)
    Block(BlockString)
    }

    String values with their quote style
    impl Eq for StringValue
    impl Show for StringValue

    StringValue::content

    fn StringValue::content(self : StringValue) -> String

    StringValue::range

    Substitution

    pub struct Substitution {
    range :
    Range

    spread : Bool
    path : Array[StringValue]
    }

    Variable substitution ($var or ${var})
    impl Eq for Substitution

    Substitution::new

    UnquotedString

    pub struct UnquotedString {
    range :
    Range

    value : Array[Interpolation]
    pattern : Array[String]
    }

    Unquoted string that may contain substitutions

    UnquotedString::new

    UnquotedString::to_string

    fn UnquotedString::to_string(self : UnquotedString) -> String

    Value

    pub(all) enum Value {
    Scalar(Scalar)
    Array(ArrayValue)
    Map(Map)
    Import(Import)
    BlockScalar(Value, Map)
    }

    Values that can appear on the right side of a colon
    impl Eq for Value
    impl Show for Value

    Value::range

    board_keywords

    let board_keywords : Array[String]

    Board keywords (create new boards)

    composite_keywords

    let composite_keywords : Array[String]

    Keywords that hold composites

    fill_patterns

    let fill_patterns : Array[String]

    Valid fill patterns

    is_board_keyword

    fn is_board_keyword(s : String) -> Bool

    Check if a string is a board keyword

    is_reserved_keyword

    fn is_reserved_keyword(s : String) -> Bool

    Check if a string is a reserved keyword

    is_style_keyword

    fn is_style_keyword(s : String) -> Bool

    Check if a string is a style keyword

    label_positions

    let label_positions : Array[String]

    Label positions

    near_constants

    let near_constants : Array[String]

    Near constant positions

    simple_reserved_keywords

    let simple_reserved_keywords : Array[String]

    Simple reserved keywords (non-style, non-composite)

    style_keywords

    let style_keywords : Array[String]

    Style keywords (must be inside "style" block)

    text_transforms

    let text_transforms : Array[String]

    Valid text transforms