Closed
Description
The rep parser combinator makes the commit parser combinator ineffective, for example this should not parse but does:
import scala.util.parsing.combinator._
object Test extends RegexParsers {
def test = parseAll(rep(commit("a")) ~ "b", "aaab")
}
I believe the problem is Parsers.scala 649-652
@tailrec def applyp(in0: Input): ParseResult[List[T]] = p0(in0) match {
case Success(x, rest) => elems += x ; applyp(rest)
case _ => Success(elems.toList, in0)
}
should be:
@tailrec def applyp(in0: Input): ParseResult[List[T]] = p0(in0) match {
case Success(x, rest) => elems += x ; applyp(rest)
case e @ Error(_, _) => e
case _ => Success(elems.toList, in0)
}