gallais / idris-tparsec

TParsec - Total Parser Combinators in Idris
https://gallais.github.io/idris-tparsec/
GNU General Public License v3.0
93 stars 10 forks source link

Add documentation to Combinators #25

Closed andrevidela closed 5 years ago

andrevidela commented 5 years ago

I've added doc strings for most of the functions in Combinators.idr.

Could you please review, and give feedback?

I also have a question for the betweenopt combinator.

The current implementation is landopt (roptand open p) close. But doesn't this allow allow the surrounding parsers to be mismatched?

For example betweenopt (char "(") (exact "a") (char ")") would match (a, wouldn't it?

gallais commented 5 years ago

I also have a question for the betweenopt combinator.

You are right, this looks like a bug to me. In agdarsec the definition of between? is the one you describe.

andrevidela commented 5 years ago

@gallais I replaced the implementation of betweenopt by the suggested one.

andrevidela commented 5 years ago

Is it ready to be merged?

andrevidela commented 5 years ago

So I've looked into it and changed most of the phrasing to use the present tense rather than the imperative tense ("runs" instead of "run"). I've also changed the phrasing "this parses X" for a combinator rather than use the verbose (but more correct) formulation of "this function returns a parse that parses X"