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)
  • Loading branch information
i10416 committed Jan 24, 2024
1 parent 77aa363 commit 2a88851
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +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 =
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 @@ -371,17 +371,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 2a88851

Please sign in to comment.