dashbitco / nimble_parsec

A simple and fast library for text-based parser combinators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept atoms as labels

NickNeck opened this issue · comments

Hello, I want to ask if you were open for a PR to accepting atoms as labels?
To get error tuples like: {:error, :digits_and_lowercase, "a1", %{}, {1, 0}, 0}.

Labels are used in error messages, so forcing them to be atoms would push users to write labels that are not meaningful to an external user. So unless there is a strong use case, I would keep enforcing strings.

Yes, I understand. My use case is a decoder how is decoding data from binary and a text representation (Well Known Binary/Text). In case of an error the user get an error tuple with {:error, %DecodeError{reason: ...}}. But I can put the message from nimble_parsec directly in DecodeError. Thank you.