bitwalker / combine

A parser combinator library for Elixir projects
MIT License
197 stars 19 forks source link

Unify parsers #15

Closed sasa1977 closed 8 years ago

sasa1977 commented 8 years ago

This PR replaces two functions generated by defparser with a single fun def using a default arg. This has the following benefits:

The second benefit is admittedly shady, since in that case you'd always need to provide the first arg (previous parser) to be able to override other defaults.

However, the first benefit reduces the need to write two specs for each parser. It also allows to use e.g. @doc false to suppress doc for some parser. With the master version this is not possible, as @doc will affect only the first created function.

In addition, I added an option to include links to GH repo in the generated docs so it's a bit more easier to see the implementation of some parser, if needed.

bitwalker commented 8 years ago

I like it! I was always mildly annoyed at the inflexibility of the old approach, though never enough to fix it, thanks for diving in and addressing that!