Skip to content

Commit 4e69d79

Browse files
i10416WojciechMazur
authored andcommitted
improve: just use content_LT to fix 16458
Just replacing element with content_LT, it works. See #19522 (comment) [Cherry-picked 27046fe]
1 parent 38653b1 commit 4e69d79

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

Diff for: compiler/src/dotty/tools/dotc/parsing/xml/MarkupParserCommon.scala

-8
Original file line numberDiff line numberDiff line change
@@ -202,14 +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
212-
213205
/** scan [3] S ::= (#x20 | #x9 | #xD | #xA)+ */
214206
def xSpace(): Unit =
215207
if (isSpace(ch)) { nextch(); xSpaceOpt() }

Diff for: compiler/src/dotty/tools/dotc/parsing/xml/MarkupParsers.scala

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

0 commit comments

Comments
 (0)