File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
compiler/src/dotty/tools/dotc/parsing/xml Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,10 @@ object MarkupParsers {
74
74
75
75
import parser .{ symbXMLBuilder => handle }
76
76
77
- def curOffset : Int = input.charOffset - 1
77
+ def curOffset : Int =
78
+ val res = input.charOffset - 1
79
+ if res > 0 && input.buf(res) == '\n ' && input.buf(res- 1 ) == '\r ' then res - 1 else res
80
+
78
81
var tmppos : Span = NoSpan
79
82
def ch : Char = input.ch
80
83
/** this method assign the next character to ch and advances in input */
@@ -342,14 +345,14 @@ object MarkupParsers {
342
345
}
343
346
344
347
/** Use a lookahead parser to run speculative body, and return the first char afterward. */
345
- private def charComingAfter (body : => Unit ): Char = {
348
+ private def charComingAfter (body : => Unit ): Char =
349
+ val saved = input
346
350
try {
347
351
input = input.lookaheadReader()
348
352
body
349
353
ch
350
354
}
351
- finally input = parser.in
352
- }
355
+ finally input = saved
353
356
354
357
/** xLiteral = element { element }
355
358
* @return Scala representation of this xml literal
@@ -361,7 +364,6 @@ object MarkupParsers {
361
364
362
365
val ts = new ArrayBuffer [Tree ]
363
366
val start = curOffset
364
- tmppos = Span (curOffset) // Iuli: added this line, as it seems content_LT uses tmppos when creating trees
365
367
content_LT(ts)
366
368
367
369
// parse more XML?
You can’t perform that action at this time.
0 commit comments