iex(1)> parser = Abnf.load("priv/rfc5234.abnf")
Rfc5234
iex(2)> parser.parse(:rule, "DQUOTE = %x22\r\n")
[{:rule, "DQUOTE = %x22\r\n",
[{:rulename, "DQUOTE",
[{:ALPHA, "D", [{:literal, "D", []}]}, {:ALPHA, "Q", [{:literal, "Q", []}]},
{:ALPHA, "U", [{:literal, "U", []}]}, {:ALPHA, "O", [{:literal, "O", []}]},
{:ALPHA, "T", [{:literal, "T", []}]},
{:ALPHA, "E", [{:literal, "E", []}]}]},
{:"defined-as", " = ",
[{:"c-wsp", " ", [{:WSP, " ", [{:SP, " ", [{:literal, " ", []}]}]}]},
{:literal, "=", []},
{:"c-wsp", " ", [{:WSP, " ", [{:SP, " ", [{:literal, " ", []}]}]}]}]},
{:elements, "%x22",
[{:alternation, "%x22",
[{:concatenation, "%x22",
[{:repetition, "%x22",
[{:element, "%x22",
[{:"num-val", "%x22",
[{:literal, "%", []},
{:"hex-val", "x22",
[{:literal, "x", []},
{:HEXDIG, "2", [{:DIGIT, "2", [{:literal, "2", []}]}]},
{:HEXDIG, "2",
[{:DIGIT, "2", [{:literal, "2", []}]}]}]}]}]}]}]}]}]},
{:"c-nl", "\r\n",
[{:CRLF, "\r\n",
[{:CR, "\r", [{:literal, "\r", []}]},
{:LF, "\n", [{:literal, "\n", []}]}]}]}]}]
- Build minimal parser
- Build minimal generator
- Use self-hosted parser
- Parse rfc2822
- Clean up generator
- Improve test coverage
- Log error messages during parsing
- Improve UX of parsing for specific rules
If available in Hex, the package can be installed as:
-
Add abnf to your list of dependencies in
mix.exs
:def deps do [{:abnf, "~> 0.0.1"}] end
-
Ensure abnf is started before your application:
def application do [applications: [:abnf]] end