File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -313,8 +313,13 @@ object Scanners {
313313 // when skipping and therefore might erroneously end up syncing on a nested OUTDENT.
314314 if debugTokenStream then
315315 println(s " \n START SKIP AT ${sourcePos().line + 1 }, $this in $currentRegion" )
316- while ! atStop do
316+ var noProgress = 0
317+ // Defensive measure to ensure we always get out of the following while loop
318+ // even if source file is weirly formatted (i.e. we never reach EOF
319+ while ! atStop && noProgress < 3 do
320+ val prevOffset = offset
317321 nextToken()
322+ if offset == prevOffset then noProgress += 1 else noProgress = 0
318323 if debugTokenStream then
319324 println(s " \n STOP SKIP AT ${sourcePos().line + 1 }, $this in $currentRegion" )
320325 if token == OUTDENT then dropUntil(_.isInstanceOf [Indented ])
You can’t perform that action at this time.
0 commit comments