vxml/blame

Source provenance for VXML trees.

Blame values attach origin information to VXML nodes, attributes, and lines. Source blame can be movable or anchored, which lets parsers and transformation pipelines preserve useful locations while slicing or moving text.

Types

Provenance for a VXML node, attribute, or line.

pub type Blame {
  Src(
    comments: List(String),
    path: String,
    line_no: Int,
    char_no: Int,
    cursor: SourceCursor,
  )
  Des(comments: List(String), name: String, line_no: Int)
  Ext(comments: List(String), name: String)
  NoBlame(comments: List(String))
}

Constructors

  • Src(
      comments: List(String),
      path: String,
      line_no: Int,
      char_no: Int,
      cursor: SourceCursor,
    )
  • Des(comments: List(String), name: String, line_no: Int)
  • Ext(comments: List(String), name: String)
  • NoBlame(comments: List(String))
pub type BlameTableMarginColumnsMinMax {
  BlameTableMarginColumnsMinMax(min: Int, max: Int)
}

Constructors

  • BlameTableMarginColumnsMinMax(min: Int, max: Int)

Whether a source position can move when text is sliced or shifted.

pub type SourceCursor {
  Movable
  Anchored
}

Constructors

  • Movable
  • Anchored

Values

pub fn advance(blame: Blame, by: Int) -> Blame

Advance movable source blame by a character offset.

pub fn append_comment(blame: Blame, comment: String) -> Blame
pub fn blame_digest(blame: Blame) -> String

Render a short human-readable blame label.

pub fn blamed_strings_annotated_table(
  lines: List(#(Blame, String)),
  banner: String,
  blame_digest_margin: BlameTableMarginColumnsMinMax,
  comments_margin: BlameTableMarginColumnsMinMax,
) -> List(String)
pub fn clear_comments(blame: Blame) -> Blame

Remove comments while preserving the main blame identity.

pub fn comments_digest(blame: Blame) -> String
pub const no_blame: Blame
pub fn path_contains(blame: Blame, s: String) -> Bool
pub fn prepend_comment(blame: Blame, comment: String) -> Blame

Add a comment before existing blame comments.

pub fn set_anchored(blame: Blame) -> Blame

Mark source blame as anchored.

Search Document