Skip to content

Commit

Permalink
improve: just use content_LT to fix 16458
Browse files Browse the repository at this point in the history
Just replacing element with content_LT, it works.

See #19522 (comment)

[Cherry-picked 27046fe]
  • Loading branch information
i10416 authored and WojciechMazur committed Jul 1, 2024
1 parent 38653b1 commit 4e69d79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,6 @@ private[dotty] trait MarkupParserCommon {
/** skip optional space S? */
def xSpaceOpt(): Unit = while (isSpace(ch) && !eof) nextch()

/** skip optional space S? and return the number of consumed characters */
def xSpaceOptN(): Int =
var i = 0
while (isSpace(ch) && !eof) do
nextch()
i += 1
i

/** scan [3] S ::= (#x20 | #x9 | #xD | #xA)+ */
def xSpace(): Unit =
if (isSpace(ch)) { nextch(); xSpaceOpt() }
Expand Down
15 changes: 4 additions & 11 deletions compiler/src/dotty/tools/dotc/parsing/xml/MarkupParsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,10 @@ object MarkupParsers {
// parse more XML?
if (charComingAfter(xSpaceOpt()) == '<') {
while {
if xSpaceOptN() == 0 then
nextch()
if content_LT(ts) then // Is `</>` valid xml?
xToken("/>")
charComingAfter(xSpaceOpt()) == '<'
else
// this is surely not a special node as any special node
// should start with `<{special symbol}` without space.
nextch()
ts.append(element)
charComingAfter(xSpaceOpt()) == '<'
xSpaceOpt()
nextch()
content_LT(ts)
charComingAfter(xSpaceOpt()) == '<'
} do ()
handle.makeXMLseq(Span(start, curOffset, start), ts)
}
Expand Down

0 comments on commit 4e69d79

Please sign in to comment.