Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined function defparsec/1 #63

Closed
daviwesley opened this issue Oct 14, 2019 · 2 comments
Closed

Undefined function defparsec/1 #63

daviwesley opened this issue Oct 14, 2019 · 2 comments

Comments

@daviwesley
Copy link

I created a project using the mix new project and add the dependency in mix.exs, I found this example in documentation

defmodule MyParser do
  import NimbleParsec

  defparsec integer(min: 1) |> tag(:integer)
end
MyParser.integer("1234")

when I run this example from project directory using the iex -S mix I got this error message
** (CompileError) iex:12: undefined function defparsec/1

Elixir 1.9.1
NimbleParser 0.5.1

@wojtekmach
Copy link
Member

wojtekmach commented Oct 14, 2019

there's no defparsec/1 but there's defparsec/2,3; you need to give a name to your parsec:

defparsec :my_int, integer(min: 1) |> tag(:integer)

@wojtekmach
Copy link
Member

Oh, the documentation is wrong indeed in a couple places, I'll fix it up. Thanks for the report!

wojtekmach added a commit that referenced this issue Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants