Omochice/pele/errors does not have a README file

    Edit

    type Edit = (Int, Int, Int)

    An input range [from, to) replaced by length output characters.

    PeleError

    pub(all) suberror PeleError {
    PeleError(Failure)
    }

    A diagram that pele cannot render, with the same codes and messages as pele's PeleError.

    ErrorCode

    pub(all) enum ErrorCode {
    UnsupportedDiagram
    Syntax
    Semantic
    Limit
    }

    What kind of failure a PeleError reports, as pele's PeleErrorCode.

    ErrorCode::to_string

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

    The code as pele spells it.

    Failure

    pub(all) struct Failure {
    message : String
    code : ErrorCode
    kind : String?
    mermaid_type : String?
    line : Int
    column : Int
    snippet : String
    }

    The details of a rejected diagram. kind and mermaid_type are None until the diagram type is known.

    Origin

    pub(all) struct Origin {
    parsed : String
    find : (Int) -> (String, Int)
    }

    The text being parsed, and how to find an offset of it in the source as written.

    input_offset

    fn input_offset(steps : Array[Array[(Int, Int, Int)]], at : Int) -> Int

    Where the output offset at comes from in the input of the first of steps, each of which lists the edits one pass made, in order.

    locate

    fn locate(src : String, offset : Int) -> (Int, Int, String)

    Where offset is in src: its line and column from 1, and its line with a caret under it.

    locating_in

    fn[T] locating_in(next : Origin, run : () -> T raise PeleError) -> T raise PeleError

    Runs run with positions in next.parsed reported in the source it was made from.

    pele_error

    fn pele_error(message : String, code? : ErrorCode, kind? : String, mermaid_type? : String, line? : Int, column? : Int, snippet? : String) -> PeleError

    Builds a PeleError; code defaults to Syntax as in pele.

    syntax_error

    fn syntax_error(kind : String, src : String, offset : Int, detail : String, lexical? : Bool) -> PeleError

    A syntax PeleError at offset with Mermaid's wording, for a lexical error when lexical.

    written

    fn written(src : String, offset : Int) -> (String, Int)

    The source as written and the offset in it that offset in src comes from, when src is exactly the text being parsed; otherwise src and offset themselves.

    Source Files