View Source Minipeg.Parsers.LispyParser (Minipeg v0.7.4)
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
Like the s_exp_parser but custom parsers can be added for specific element parsers that can be added with priority over the default element parsers or replace them.
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_list_t() :: [ast_t()]
@type ast_t() :: any()
@type atoms() :: [atom()]
@type binaries() :: [binary()]
@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 position_t() :: {pos_integer(), pos_integer()}
@type result_t() :: Minipeg.Failure.t() | Minipeg.Ignore.t() | Minipeg.Success.t()
@type satisfier_t() :: (any() -> satisfier_result_t())
@type str_or_count_t() :: binary() | non_neg_integer()
@type token_comp_t() :: [token1_comp_t()]
@type token_spec_t() :: [token1_spec_t()]
Functions
@spec customized_s_exp_parser(binary?(), Keyword.t()) :: Minipeg.Parser.t()
Like the s_exp_parser but custom parsers can be added for specific element parsers that can be added with priority over the default element parsers or replace them.
And we can also configure the already configurable parts of the s_exp_parser via the keywords, which are:
opening_literal: defaulting to "(" closing_literal: defaulting to ")" element_parsers: list of parsers (which are parsed before the default elements parser) replace_default: defaults to false, but if set to true the default element parsers are not used
@spec element_parser(binary?()) :: Minipeg.Parser.t()
parses a string, integer, name (atom) or s-exp
@spec name_parser(binary?()) :: Minipeg.Parser.t()
Parses a name which is actually any non digit starting printable character sequence
@spec s_exp_parser(binary?(), binary(), binary()) :: Minipeg.Parser.t()
Parses an s-expression according to the schema above