From fe57b90a8f4db40552649aab8fbb75180b7f6811 Mon Sep 17 00:00:00 2001 From: Jendrik Wenke Date: Fri, 23 Feb 2018 15:00:09 +0100 Subject: [PATCH] Added CharSequenceReader.toString improved log() by adding CharSequenceReader.toString current: trying foo at CharSequenceReader@abcd proposed: trying foo at CharSequenceReader('#', ...) --- .../scala/util/parsing/input/CharSequenceReader.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shared/src/main/scala/scala/util/parsing/input/CharSequenceReader.scala b/shared/src/main/scala/scala/util/parsing/input/CharSequenceReader.scala index 36e630ee..ac2dfbe5 100644 --- a/shared/src/main/scala/scala/util/parsing/input/CharSequenceReader.scala +++ b/shared/src/main/scala/scala/util/parsing/input/CharSequenceReader.scala @@ -63,4 +63,12 @@ class CharSequenceReader(override val source: java.lang.CharSequence, */ override def drop(n: Int): CharSequenceReader = new CharSequenceReader(source, offset + n) + + /** Returns a String in the form `CharSequenceReader(first, ...)`, + * or `CharSequenceReader()` if this is `atEnd`. + */ + override def toString: String = { + val c = if (atEnd) "" else s"'$first', ..." + s"CharSequenceReader($c)" + } }