Sign in

    quote

    A MoonBit library for handling and manipulating quotations and quoted text

    macro
    meta-programming
    quote
    quotation
    utility
    Download zip
    Version
    0.2.0
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    46

    #illusory0x0/quote

    The quote utility allows you to select code snippets from source files and returns a SourceLocation.

    You can use this to read files and extract code snippets from them.

    After that, you can manipulate the code snippets like Rust procedure macros.

    ///|
    test {
    let s = quote(x => x + 1)
    inspect(s.path.to_string().contains("README.mbt.md"), content="true")
    inspect(s.start, content="{row: 12, column: 11}")
    inspect(s.end, content="{row: 12, column: 28}")
    let s = current_source_location()
    inspect(s.path.to_string().contains("README.mbt.md"), content="true")
    inspect(s.start, content="{row: 16, column: 11}")
    inspect(s.end, content="{row: 16, column: 36}")
    }

    Path

    typealias
    Path
    as Path

    ParseSourceLocationError

    pub suberror ParseSourceLocationError {
    ParseError(String)
    }

    Position

    pub(all) struct Position {
    row : Int
    column : Int
    }

    impl Show for Position
    impl ToJson for Position

    SourceLocation

    pub(all) struct SourceLocation {
    path :
    Path

    start : Position
    end : Position
    }

    SourceLocation::parse

    SourceLocation::split_file

    fn SourceLocation::split_file(file : String, locs : Array[SourceLocation]) -> Array[StringView]

    current_source_location

    #callsite(autofill(loc))
    fn current_source_location(loc~ : SourceLoc) -> SourceLocation raise ParseSourceLocationError

    quote

    #callsite(autofill(loc))
    fn[Code] quote(code : Code, loc~ : SourceLoc) -> SourceLocation raise ParseSourceLocationError

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io