element.version === currentVersion)) { versionNodes.unshift({ version: currentVersion, url: "#" }); } document.querySelector("#project-version").innerHTML = versionNodes.reduce( (acc, element) => { const status = currentVersion === element.version ? "selected disabled" : ""; return ` ${acc} `; }, `
atto · v1.2.1

atto

Robust and extensible parser-combinators for Gleam.

fn number() {
  use digits <- do(atto.match("[1-9][0-9]*"))
  let assert Ok(n) = int.from_string(digits)
  n
}

fn number_list() {
  atto.between(
    atto.token("["),
    atto.sep(number, by: atto.token(",")),
    atto.token("]"),
  )
}

atto.run(number_list, text.new("[1,23,5]", Nil))
// -> Ok([1, 23, 5])

Features

  • Combinators for building parsers, such as many, sep, and between.
  • Beautiful error messages.
  • Custom stream type support, so atto works with a lexer step or on non-string data.
  • Custom context value for contextual grammars.

Resources

Search Document