aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/scala/org/perl8/test/tap/Parser.scala20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/main/scala/org/perl8/test/tap/Parser.scala b/src/main/scala/org/perl8/test/tap/Parser.scala
index 8674c18..f422b4e 100644
--- a/src/main/scala/org/perl8/test/tap/Parser.scala
+++ b/src/main/scala/org/perl8/test/tap/Parser.scala
@@ -111,20 +111,14 @@ class Parser (cb: TAPEvent => Unit) extends Parsers {
}
}
- private def LineParser[T] (
- lineType: String
- )(
+ private def LineParser[T] (lineType: String)(
body: Input => ParseResult[T]
- ): Parser[T] = {
- new Parser[T] {
- def apply (in: Input): ParseResult[T] = {
- if (in.atEnd) {
- Failure(lineType + " line expected, but end of input found", in)
- }
- else {
- body(in)
- }
- }
+ ): Parser[T] = Parser { in =>
+ if (in.atEnd) {
+ Failure(lineType + " line expected, but end of input found", in)
+ }
+ else {
+ body(in)
}
}