parser_gleam/char

Types

pub type Char =
  String

Functions

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

Matches a single letter, digit or underscore character.

pub fn char(c: String) -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

The char parser constructor returns a parser which matches only the specified single character

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

Matches a single digit.

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

Matches a single ASCII letter.

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

Matches a single lower case ASCII letter.

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

Takes a Parser<Char, string> and matches it zero or more times, returning a string of what was matched.

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

Takes a Parser<Char, string> and matches it one or more times, returning a string of what was matched.

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

Matches a single character which isn’t a letter, digit or underscore.

pub fn not_char(c: String) -> fn(Stream(String)) ->
  Result(ParseSuccess(String, String), ParseError(String))

The notChar parser constructor makes a parser which will match any single character other than the one provided.

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

Matches a single character which isn’t a digit.

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

Matches a single character which isn’t an upper case ASCII letter.

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

Matches a single character which isn’t a lower case ASCII letter.

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

Matches a single character which isn’t a character from the provided string.

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

Matches a single character which isn’t whitespace.

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

Matches a single character which isn’t an upper case ASCII letter.

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

Matches any one character from the provided string.

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

Matches a single whitespace character.

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

Matches a single Unicode letter. Works for scripts which have a notion of an upper case and lower case letters (Latin-based scripts, Greek, Russian etc).

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

Matches a single upper case ASCII letter.

Search Document