renatoathaydes / parcey

A combinator parser for Ceylon
Apache License 2.0
11 stars 0 forks source link

problem with an empty‐giving parser passed to `many` #11

Open zamfofex opened 7 years ago

zamfofex commented 7 years ago
value parser = sequenceOf({many(skip(text("test-"))), endOfInput()});
print(parser.parse("")); // okay
print(parser.parse("test-")); // okay
print(parser.parse("test-test-")); //fail
print(parser.parse("test-test-test-")); // fail

The problem seems to be in line 127 of combinators.ceylon:

return if (!is ErrorMessage result, !result.result.empty)

I think it should have to be:


return if (!is ErrorMessage result)
renatoathaydes commented 7 years ago

I hope to get some time to finish my refactoring of this library... it was hairy stuff to get proper error messages (and better performance by a large margin, btw).

So, you're probably right that this should be an easy fix, but before I finish the refactoring there's little point fixing this, I'm afraid.

Do you need a tiny release fixing only this error? Did you test if your solution works?

zamfofex commented 7 years ago

@renatoathaydes

Do you need a tiny release fixing only this error?

No, I can somewhat easily work around it.

Did you test if your solution works?

I didn’t test it thoroughly, but it seems to work for the few cases I’ve tried.