From c9f6d655362863afe66458f91f556905b8002ed5 Mon Sep 17 00:00:00 2001 From: Aleksandar Pokopec Date: Tue, 22 Feb 2011 16:30:37 +0000 Subject: Fixes and closes #4261. No review. --- src/library/scala/xml/Utility.scala | 8 ++++++-- .../scala/xml/parsing/MarkupParserCommon.scala | 9 +++------ todoticks.txt | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 todoticks.txt diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala index 2d0682a47d..995563e9ac 100644 --- a/src/library/scala/xml/Utility.scala +++ b/src/library/scala/xml/Utility.scala @@ -22,6 +22,8 @@ import parsing.XhtmlEntities */ object Utility extends AnyRef with parsing.TokenTests { + final val SU = '\u001A' + implicit def implicitSbToString(sb: StringBuilder) = sb.toString() // helper for the extremely oft-repeated sequence of creating a @@ -360,7 +362,7 @@ object Utility extends AnyRef with parsing.TokenTests c = it.next if (c == '#') { c = it.next - val theChar = parseCharRef ({ ()=> c },{ () => c = it.next },{s => throw new RuntimeException(s)}) + val theChar = parseCharRef ({ ()=> c },{ () => c = it.next },{s => throw new RuntimeException(s)}, {s => throw new RuntimeException(s)}) sb.append(theChar) } else { @@ -410,7 +412,7 @@ object Utility extends AnyRef with parsing.TokenTests * @param reportSyntaxError ... * @return ... */ - def parseCharRef(ch: () => Char, nextch: () => Unit, reportSyntaxError: String => Unit): String = { + def parseCharRef(ch: () => Char, nextch: () => Unit, reportSyntaxError: String => Unit, reportTruncatedError: String => Unit): String = { val hex = (ch() == 'x') && { nextch(); true } val base = if (hex) 16 else 10 var i = 0 @@ -425,6 +427,8 @@ object Utility extends AnyRef with parsing.TokenTests "Did you mean to write &#x ?") else i = i * base + ch().asDigit + case SU => + reportTruncatedError("") case _ => reportSyntaxError("character '" + ch() + "' not allowed in char ref\n") } diff --git a/src/library/scala/xml/parsing/MarkupParserCommon.scala b/src/library/scala/xml/parsing/MarkupParserCommon.scala index b11c908bc2..d2174c2879 100644 --- a/src/library/scala/xml/parsing/MarkupParserCommon.scala +++ b/src/library/scala/xml/parsing/MarkupParserCommon.scala @@ -14,10 +14,7 @@ import scala.xml.dtd._ import scala.annotation.switch import Utility.Escapes.{ pairs => unescape } -object MarkupParserCommon { - final val SU = '\u001A' -} -import MarkupParserCommon._ +import Utility.SU /** This is not a public trait - it contains common code shared * between the library level XML parser and the compiler's. @@ -158,11 +155,11 @@ private[scala] trait MarkupParserCommon extends TokenTests { * see [66] */ def xCharRef(ch: () => Char, nextch: () => Unit): String = - Utility.parseCharRef(ch, nextch, reportSyntaxError _) + Utility.parseCharRef(ch, nextch, reportSyntaxError _, truncatedError _) def xCharRef(it: Iterator[Char]): String = { var c = it.next - Utility.parseCharRef(() => c, () => { c = it.next }, reportSyntaxError _) + Utility.parseCharRef(() => c, () => { c = it.next }, reportSyntaxError _, truncatedError _) } def xCharRef: String = xCharRef(() => ch, () => nextch) diff --git a/todoticks.txt b/todoticks.txt new file mode 100644 index 0000000000..5f95bff27d --- /dev/null +++ b/todoticks.txt @@ -0,0 +1,22 @@ +#4221 - tell paul about the impl. seearch - go ahead. +#4225 - close as invalid +#4237 - assign to adriaan +#4238 - generic signature - assign to iulian +#4240 - assign to paul +#4242 - lukas +#4244 - iuli +#4247 - postpone until later +#4248 - cunei +#4249 - martin +#4252 - gilles +#4256 - wontfix - switching to jira +#4259 - keep it open +#4261 - check who committed - add two lines, find out who added it +#4264 - martin +#4265 - postpone until later +#4270 - martin +#4271 - adriaan +#4273 - adriaan +#4275 - martin, close #1071 as duplicate +#4276 - postpone until later +#4279 - why don't you keep it for a moment - have an annotation for doing this? -- cgit v1.2.3