Skip to content

Commit 2a88851

Browse files
committed
improve: just use content_LT to fix 16458
Just replacing element with content_LT, it works. See #19522 (comment)
1 parent 77aa363 commit 2a88851

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

compiler/src/dotty/tools/dotc/parsing/xml/MarkupParserCommon.scala

-7
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,6 @@ private[dotty] trait MarkupParserCommon {
202202
/** skip optional space S? */
203203
def xSpaceOpt(): Unit = while (isSpace(ch) && !eof) nextch()
204204

205-
/** skip optional space S? and return the number of consumed characters */
206-
def xSpaceOptN(): Int =
207-
var i = 0
208-
while (isSpace(ch) && !eof) do
209-
nextch()
210-
i += 1
211-
i
212205

213206
/** scan [3] S ::= (#x20 | #x9 | #xD | #xA)+ */
214207
def xSpace(): Unit =

compiler/src/dotty/tools/dotc/parsing/xml/MarkupParsers.scala

+4-11
Original file line numberDiff line numberDiff line change
@@ -371,17 +371,10 @@ object MarkupParsers {
371371
// parse more XML?
372372
if (charComingAfter(xSpaceOpt()) == '<') {
373373
while {
374-
if xSpaceOptN() == 0 then
375-
nextch()
376-
if content_LT(ts) then // Is `</>` valid xml?
377-
xToken("/>")
378-
charComingAfter(xSpaceOpt()) == '<'
379-
else
380-
// this is surely not a special node as any special node
381-
// should start with `<{special symbol}` without space.
382-
nextch()
383-
ts.append(element)
384-
charComingAfter(xSpaceOpt()) == '<'
374+
xSpaceOpt()
375+
nextch()
376+
content_LT(ts)
377+
charComingAfter(xSpaceOpt()) == '<'
385378
} do ()
386379
handle.makeXMLseq(Span(start, curOffset, start), ts)
387380
}

0 commit comments

Comments
 (0)