We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We don't allow p.rep on a p: Parser0[_] because if you parse nothing and that is valid, at parse time you would loop infinitely not making progress.
p.rep
p: Parser0[_]
Another idea could be:
def safeRep: Parser0[(NonEmptyList[A], Boolean)] = (Parser.index, this, Parser.index) .tupled .flatMap { case (s, a, e) => if (s == e) { // No progress, stop Parser.pure((NonEmptyList(a, Nil), false)) } else safeRep.?.map { case None => (NonEmptyList(a, Nil), true) case Some((tail, r)) => (a :: tail, r) } }
the boolean tells if the last item made progress or not.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We don't allow
p.rep
on ap: Parser0[_]
because if you parse nothing and that is valid, at parse time you would loop infinitely not making progress.Another idea could be:
the boolean tells if the last item made progress or not.
The text was updated successfully, but these errors were encountered: