parser_gleam/string

Functions

pub fn double_quoted_string() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

Parses a double quoted string, with support for escaping double quotes inside it, and returns the inner string. Does not perform any other form of string escaping.

pub fn float() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, Float), ParseError(String))
pub fn fold(ass: List(
    fn(Stream(a)) ->
      Result(ParseSuccess(a, String), ParseError(a)),
  )) -> fn(Stream(a)) ->
  Result(ParseSuccess(a, String), ParseError(a))

Matches one of a list of strings.

pub fn int() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, Int), ParseError(String))
pub fn many(parser: fn(Stream(String)) ->
    Result(ParseSuccess(String, String), ParseError(String))) -> fn(
  Stream(String),
) -> Result(ParseSuccess(String, String), ParseError(String))

Matches the given parser zero or more times, returning a string of the entire match

pub fn many1(parser: fn(Stream(String)) ->
    Result(ParseSuccess(String, String), ParseError(String))) -> fn(
  Stream(String),
) -> Result(ParseSuccess(String, String), ParseError(String))

Matches the given parser zero or more times, returning a string of the entire match

pub fn maybe(p: fn(Stream(a)) ->
    Result(ParseSuccess(a, String), ParseError(a))) -> fn(
  Stream(a),
) -> Result(ParseSuccess(a, String), ParseError(a))
pub fn not_spaces() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

Matches zero or more non-whitespace characters.

pub fn not_spaces1() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

Matches one or more non-whitespace characters.

pub fn one_of(lst: List(String)) -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))
pub fn run(str: String) -> fn(
  fn(Stream(String)) ->
    Result(ParseSuccess(String, a), ParseError(String)),
) -> Result(ParseSuccess(String, a), ParseError(String))

Creates a stream from string and runs the parser.

pub fn spaces() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

Matches zero or more whitespace characters.

pub fn spaces1() -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

Matches one or more whitespace characters.

pub fn string(s: String) -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

Matches the exact string provided.

Search Document