summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/util/parsing/combinator/Parsers.scala18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala
index 1061b85ac8..04e4fa432a 100644
--- a/src/library/scala/util/parsing/combinator/Parsers.scala
+++ b/src/library/scala/util/parsing/combinator/Parsers.scala
@@ -596,13 +596,17 @@ trait Parsers {
// assert(res.isInstanceOf[NoSuccess])
- if (!xs.isEmpty) {
- // the next parser should start parsing where p failed,
- // since `!p(in).successful', the next input to be consumed is `in'
- Success(xs.toList, in) // TODO: I don't think in == res.next holds
- }
- else {
- Failure(res.asInstanceOf[NoSuccess].msg, in0)
+ res match {
+ case e: Error => e
+ case _ =>
+ if (!xs.isEmpty) {
+ // the next parser should start parsing where p failed,
+ // since `!p(in).successful', the next input to be consumed is `in'
+ Success(xs.toList, in) // TODO: I don't think in == res.next holds
+ }
+ else {
+ Failure(res.asInstanceOf[NoSuccess].msg, in0)
+ }
}
}