Skip to content

rep overrides commit #6067

Closed
Closed
@scabug

Description

@scabug

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)
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions