View Source Chrysopoeia.Base.Codepoint (chrysopoeia v0.1.2)

Base module for parsing codepoints.

Link to this section Summary

Functions

Consumes the first codepoint of str, if possible.

A combinator that consumes a single codepoint, if fun.(codepoint) is true.

Checks if the first codepoint of str is alphabetical.

Checks if the first codepoint of str is either alphabetical or a digit.

Checks if the first codepoint of str is a digit (0-9).

Checks if cp is a whitespace codepoint

Takes the first n codepoints from str, if possible.

A combinator that consumes codepoints while fun.(codepoint) is true.

Link to this section Functions

@spec first(i) :: {:ok, char(), i} | {:err, any()} when i: String.t()

Consumes the first codepoint of str, if possible.

@spec first_if((char() -> boolean())) :: Chrysopoeia.parser(String.t(), char(), any())

A combinator that consumes a single codepoint, if fun.(codepoint) is true.

@spec is_alpha?(char()) :: boolean()

Checks if the first codepoint of str is alphabetical.

@spec is_alphanum?(char()) :: boolean()

Checks if the first codepoint of str is either alphabetical or a digit.

@spec is_digit?(char()) :: boolean()

Checks if the first codepoint of str is a digit (0-9).

@spec is_whitespace?(char()) :: boolean()

Checks if cp is a whitespace codepoint

@spec take(char()) :: Chrysopoeia.parser(String.t(), charlist(), any())

Takes the first n codepoints from str, if possible.

Returns a list of codepoints.

@spec take_while((char() -> boolean())) ::
  Chrysopoeia.parser(String.t(), charlist(), any())

A combinator that consumes codepoints while fun.(codepoint) is true.