@@ -704,7 +704,11 @@ object Parsers {
704704 val t = enclosed(INDENT , body)
705705 if needsBraces(t) then
706706 patch(source, Span (startOpening, endOpening), " {" )
707- patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
707+ val next = in.next
708+ def closedByEndMarker =
709+ next.token == END && (next.offset - next.lineOffset) == indentWidth.toPrefix.size
710+ if closedByEndMarker then patch(source, Span (next.offset), " } // " )
711+ else patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
708712 t
709713 end indentedToBraces
710714
@@ -1411,9 +1415,6 @@ object Parsers {
14111415 val start = in.skipToken()
14121416 if stats.isEmpty || ! matchesAndSetEnd(stats.last) then
14131417 syntaxError(em " misaligned end marker " , Span (start, in.lastCharOffset))
1414- else if overlapsPatch(source, Span (start, start)) then
1415- patch(source, Span (start, start), " " )
1416- patch(source, Span (start, in.lastCharOffset), s " } // end $endName" )
14171418 in.token = IDENTIFIER // Leaving it as the original token can confuse newline insertion
14181419 in.nextToken()
14191420 end checkEndMarker
0 commit comments