View Source Minipeg.Parsers.LispyParser (Minipeg v0.2.2)

Parses s-expressions (lispy) The syntax is very simple

s_exp:

----> ( `opening_literal`) ---------------------------------------------+-------------> ( `closing_literal` ) ------>
                             ^                                          |
                             |                                          |
                             |                      +---------+         |
                             +--- (whitespace) <--- | element | <-------+
                                                    +---------+ 

element:

  string | integer | name | s_exp

opening_literal defaults to ( and closing literal defaults to ), of course

Summary

Functions

parses a string, integer, name (atom) or s-exp

Parses a name which is actually any non digit starting printable character sequence

Parses an s-expression according to the schema above

Types

@type ast_t() :: any()
@type binaries() :: [binary()]
@type binary?() :: maybe(binary())
@type char_set_t() :: [binary()] | binary()
Link to this type

either(success_t, error_t)

View Source
@type either(success_t, error_t) :: {:ok, success_t} | {:error, error_t}
@type input_t() :: binary() | [binary()] | Minipeg.Input.t()
@type maybe(t) :: nil | t
@type parser_function_t() ::
  (Minipeg.Input.t(), Minipeg.Cache.t(), binary() -> result_t())
@type result_t() :: Minipeg.Failure.t() | Minipeg.Success.t()
@type satisfier_result_t() :: either(any(), binary())
@type satisfier_t() :: (any() -> satisfier_result_t())
@type str_or_count_t() :: binary() | non_neg_integer()

Functions

Link to this function

element_parser(name \\ nil)

View Source
@spec element_parser(binary?()) :: Minipeg.Parser.t()

parses a string, integer, name (atom) or s-exp

Link to this function

name_parser(name \\ nil)

View Source
@spec name_parser(binary?()) :: Minipeg.Parser.t()

Parses a name which is actually any non digit starting printable character sequence

Link to this function

s_exp_parser(name \\ nil, opening_literal \\ "(", closing_literal \\ ")")

View Source
@spec s_exp_parser(binary?(), binary(), binary()) :: Minipeg.Parser.t()

Parses an s-expression according to the schema above