nimble_parsec icon indicating copy to clipboard operation
nimble_parsec copied to clipboard

A simple and fast library for text-based parser combinators

Results 7 nimble_parsec issues
Sort by recently updated
recently updated
newest added

An example: ```elixir Mix.install([{:nimble_parsec, "~> 1.2"}]) defmodule Bug do import NimbleParsec def n_times(_, context, _, _) do context |> IO.inspect() if context.count > 0 do {:cont, %{context | count: context.count...

This code ``` defmodule ParserRepro do import NimbleParsec defparsec(:foo_parsec, integer(min: 1)) end ``` emits a warning ``` warning: this clause cannot match because of different types/sizes ``` debug: ``` defp...

Currently integers are matched by pattern matching on number between 48 and 57 and then substracting 48 ascii code - that is integer 0 As 48 is 0x30 then we...

As discussed [here](https://elixirforum.com/t/nimbleparsec-a-simple-and-fast-parser-combinator-for-elixir/12860/25?u=tmbb), NimbleParsec should have an `expect` combinator for better error reporting. I suggest something like this: `expect(previous \\ [], expected)`. This combinator would raise an error is `expected`...

Ideally something like the [cheatsheet for the Enum module](https://hexdocs.pm/elixir/enum-cheat.html) or even just nom's [choosing_a_comninator.md](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md) page would be a great addition to the docs.

Let's assume I defined a combinator using post_traverse - something like `parse_date`. ``` def parse_date(combinator \\ P.empty()) do combinator |> P.post_traverse({__MODULE__, :__parse_date__, []}) end def __parse_date__(rest, acc, context, _line, _offset)...