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/ir does not have a README file

    CompileError

    pub(all) suberror CompileError {
    InvalidKey(String)
    InvalidValue(String)
    DuplicateField(String)
    InvalidSubstitution(String)
    ImportError(String)
    }

    Compilation error
    impl Eq for CompileError

    Composite

    pub(all) enum Composite {
    Array(IRArray)
    Map(Map)
    }

    Composite values (Array or Map)
    impl Eq for Composite
    impl Show for Composite

    Edge

    pub struct Edge {
    id : EdgeID
    primary : Scalar?
    map : Map?
    references : Array[EdgeReference]
    }

    An edge in the IR
    impl Eq for Edge
    impl Show for Edge

    Edge::new

    fn Edge::new(id : EdgeID, primary : Scalar?, map : Map?, references : Array[EdgeReference]) -> Edge

    EdgeID

    pub struct EdgeID {
    src_path : Array[String]
    src_arrow : Bool
    dst_path : Array[String]
    dst_arrow : Bool
    index : Int?
    glob : Bool
    }

    Unique identifier for an edge
    impl Eq for EdgeID
    impl Show for EdgeID

    EdgeID::copy

    fn EdgeID::copy(self : EdgeID) -> EdgeID

    Create a copy of this EdgeID

    EdgeID::matches

    fn EdgeID::matches(self : EdgeID, other : EdgeID) -> Bool

    Check if this EdgeID matches another (for queries)

    EdgeID::new

    fn EdgeID::new(src_path : Array[String], dst_path : Array[String], src_arrow : Bool, dst_arrow : Bool) -> EdgeID

    EdgeID::with_glob

    fn EdgeID::with_glob(src_path : Array[String], dst_path : Array[String], src_arrow : Bool, dst_arrow : Bool) -> EdgeID

    EdgeID::with_index

    fn EdgeID::with_index(src_path : Array[String], dst_path : Array[String], src_arrow : Bool, dst_arrow : Bool, index : Int) -> EdgeID

    EdgeReference

    pub struct EdgeReference {
    range :
    Range

    edge_index : Int
    primary : Bool
    due_to_glob : Bool
    due_to_lazy_glob : Bool
    }

    Reference to an edge from the AST
    impl Eq for EdgeReference

    EdgeReference::new

    fn EdgeReference::new(range :
    Range
    , edge_index : Int, primary : Bool) -> EdgeReference

    Field

    pub struct Field {
    name : String
    primary : Scalar?
    composite : Composite?
    references : Array[FieldReference]
    }

    A field in the IR map
    impl Eq for Field
    impl Show for Field

    Field::array

    fn Field::array(self : Field) -> IRArray?

    Get the array composite if this field has one

    Field::has_composite

    fn Field::has_composite(self : Field) -> Bool

    Check if this field has a composite value

    Field::has_primary

    fn Field::has_primary(self : Field) -> Bool

    Check if this field has a primary value

    Field::map

    fn Field::map(self : Field) -> Map?

    Get the map composite if this field has one

    Field::new

    fn Field::new(name : String, primary : Scalar?, composite : Composite?, references : Array[FieldReference]) -> Field

    Field::simple

    fn Field::simple(name : String) -> Field

    FieldReference

    pub struct FieldReference {
    range :
    Range

    string : String
    key_path_index : Int
    primary : Bool
    due_to_glob : Bool
    due_to_lazy_glob : Bool
    }

    Reference to a field from the AST

    FieldReference::new

    fn FieldReference::new(range :
    Range
    , string : String, key_path_index : Int, primary : Bool) -> FieldReference

    FilterContext

    pub struct FilterContext {
    field : Field
    parent_map : Map
    }

    Filter context for evaluating ampersand filters

    FilterContext::new

    fn FilterContext::new(field : Field, parent_map : Map) -> FilterContext

    IRArray

    pub struct IRArray {
    values : Array[Value]
    }

    An array of values
    impl Eq for IRArray
    impl Show for IRArray

    IRArray::new

    fn IRArray::new(values : Array[Value]) -> IRArray

    ImportResolver

    pub type ImportResolver (String) -> String?

    Import resolver function type Takes an import path and returns the file content, or None if not found

    ImportResolver::inner

    #deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
    fn ImportResolver::inner(self : ImportResolver) -> ((String) -> String?)
    Convert newtype to its underlying type, automatically derived.

    ImportResolver::new

    fn ImportResolver::new(f : (String) -> String?) -> ImportResolver

    Create a new import resolver from a function

    Map

    pub struct Map {
    fields : Array[Field]
    edges : Array[Edge]
    }

    An IR Map containing fields and edges
    impl Eq for Map
    impl Show for Map

    Map::add_edge

    fn Map::add_edge(self : Map, edge : Edge) -> Unit

    Add an edge to the map

    Map::add_field

    fn Map::add_field(self : Map, field : Field) -> Unit

    Add a field to the map

    Map::apply_glob_properties

    fn Map::apply_glob_properties(self : Map, pattern : Array[String], properties : Map, filters : Array[(Bool, String, String)]) -> Unit

    Apply properties to fields matching a glob pattern If filters are provided, only apply to fields that pass all filters

    Map::delete_field

    fn Map::delete_field(self : Map, name : String) -> Field?

    Delete a field by name, returning it if found

    Map::double_glob

    fn Map::double_glob(self : Map) -> Array[Field]

    Collect all fields matching a double glob (**) pattern This recursively collects all descendant fields except board keywords

    Map::ensure_field

    fn Map::ensure_field(self : Map, name : String) -> Field

    Get or create a field by name

    Map::find_edges

    fn Map::find_edges(self : Map, id : EdgeID) -> Array[Edge]

    Find edges matching an EdgeID

    Map::get_field

    fn Map::get_field(self : Map, name : String) -> Field?

    Get a field by name (case-insensitive)

    Map::has_field

    fn Map::has_field(self : Map, name : String) -> Bool

    Check if map has a field with given name

    Map::multi_glob

    fn Map::multi_glob(self : Map, pattern : Array[String]) -> (Array[Field], Bool)

    Collect fields matching a multi-glob pattern (** or ***) Returns (fields, is_glob_pattern)

    Map::new

    fn Map::new() -> Map

    Map::single_glob

    fn Map::single_glob(self : Map, pattern : Array[String]) -> Array[Field]

    Collect fields at one level matching a single glob pattern

    Map::triple_glob

    fn Map::triple_glob(self : Map) -> Array[Field]

    Collect all fields matching a triple glob (***) pattern This recursively collects all descendant fields including boards

    Node

    pub(all) enum Node {
    Scalar(Scalar)
    Field(Field)
    Edge(Edge)
    IRArray(IRArray)
    Map(Map)
    Composite(Composite)
    Value(Value)
    }

    Boxed IR node for generic traversal.
    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

    Scalar

    pub struct Scalar {
    value : ScalarValue
    range :
    Range

    }

    A scalar value in the IR.

    Scalars carry a source range for error reporting and reference tracking.
    impl Eq for Scalar
    impl Show for Scalar

    Scalar::as_bool

    fn Scalar::as_bool(self : Scalar) -> Bool?

    Get boolean value if this is a boolean

    Scalar::as_double

    fn Scalar::as_double(self : Scalar) -> Double?

    Scalar::as_int

    fn Scalar::as_int(self : Scalar) -> Int?

    Scalar::as_string_value

    Get underlying string value (including block-string metadata) if present

    Scalar::at

    Scalar::block_string_tag

    fn Scalar::block_string_tag(self : Scalar) -> String?

    Get block-string language tag if this scalar is a block string

    Scalar::bool

    fn Scalar::bool(b : Bool) -> Scalar

    Scalar::get_range

    Scalar::is_bool

    fn Scalar::is_bool(self : Scalar) -> Bool

    Check if scalar is a boolean

    Scalar::is_null

    fn Scalar::is_null(self : Scalar) -> Bool

    Check if scalar is null

    Scalar::is_number

    fn Scalar::is_number(self : Scalar) -> Bool

    Check if scalar is a number

    Scalar::is_string

    fn Scalar::is_string(self : Scalar) -> Bool

    Check if scalar is a string

    Scalar::new

    fn Scalar::new(value : ScalarValue) -> Scalar

    Scalar::null

    fn Scalar::null() -> Scalar

    Scalar::number

    fn Scalar::number(n : String) -> Scalar

    Scalar::string

    fn Scalar::string(s : String) -> Scalar

    Scalar::to_string

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

    Get the string representation of a scalar value

    ScalarValue

    pub(all) enum ScalarValue {
    Null
    Bool(String)
    Number(String)
    String(
    StringValue
    )
    }

    Types of scalar values
    impl Eq for ScalarValue
    impl Show for ScalarValue

    Value

    pub(all) enum Value {
    Scalar(Scalar)
    Array(IRArray)
    Map(Map)
    }

    Value types in IR
    impl Eq for Value
    impl Show for Value

    Value::as_array

    fn Value::as_array(self : Value) -> IRArray?

    Get the array if this is an array

    Value::as_map

    fn Value::as_map(self : Value) -> Map?

    Get the map if this is a map

    Value::as_scalar

    fn Value::as_scalar(self : Value) -> Scalar?

    Get the scalar value if this is a scalar

    compile

    fn compile(ast :
    Map
    ) -> Map raise CompileError

    Compile an AST Map to IR Map

    compile_with_imports

    fn compile_with_imports(ast :
    Map
    , resolver : ImportResolver) -> Map raise CompileError

    Compile an AST Map with import resolution

    evaluate_filter

    fn evaluate_filter(ctx : FilterContext, filter_key : String, filter_value : String) -> Bool

    Evaluate a filter condition against a field Returns true if the field passes the filter

    is_board_keyword

    fn is_board_keyword(name : String) -> Bool

    Check if a keyword is a board keyword

    is_double_glob

    fn is_double_glob(pattern : Array[String]) -> Bool

    Check if pattern represents a double glob (**) Parser stores ** as ["", "", ""]

    is_reserved_keyword

    fn is_reserved_keyword(name : String) -> Bool

    Check if a keyword is reserved

    is_triple_glob

    fn is_triple_glob(pattern : Array[String]) -> Bool

    Check if pattern represents a triple glob () Parser stores *** as ["", "", "", "", ""]

    match_pattern

    fn match_pattern(s : String, pattern : Array[String]) -> Bool

    Match a string against a glob pattern Pattern is an array where elements are either:
    • literal text to match
    • "*" to match any characters