scriptorium/parser/common

Types

An error that occurred when parsing content.

pub type ParseError {
  EmptyFile
  HeaderMissing
  MalformedFilename
  YearNotInt
  MonthNotInt
  DayNotInt
  InvalidDate
  MalformedHeader(header: String)
}

Constructors

  • EmptyFile
  • HeaderMissing
  • MalformedFilename
  • YearNotInt
  • MonthNotInt
  • DayNotInt
  • InvalidDate
  • MalformedHeader(header: String)

Constants

pub const filename_postfix: String

The default file extension for source files.

Functions

pub fn parse_header(
  header: String,
) -> Result(#(String, String), ParseError)

Parse given line as a header.

pub fn parse_headers(
  headers: List(String),
) -> Result(List(#(String, String)), ParseError)

Parse given lines as headers.

pub fn try(
  value: Result(a, b),
  error: c,
  if_ok: fn(a) -> Result(d, c),
) -> Result(d, c)

If the value is Ok, run if_ok, otherwise return error.

Search Document