@@ -715,7 +715,11 @@ object Parsers {
715715 val t = enclosed(INDENT , body)
716716 if needsBraces(t) then
717717 patch(source, Span (startOpening, endOpening), " {" )
718- patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
718+ val next = in.next
719+ def closedByEndMarker =
720+ next.token == END && (next.offset - next.lineOffset) == indentWidth.toPrefix.size
721+ if closedByEndMarker then patch(source, Span (next.offset), " } // " )
722+ else patch(source, Span (closingOffset(source.nextLine(in.lastOffset))), indentWidth.toPrefix ++ " }\n " )
719723 t
720724 end indentedToBraces
721725
@@ -1422,9 +1426,6 @@ object Parsers {
14221426 val start = in.skipToken()
14231427 if stats.isEmpty || ! matchesAndSetEnd(stats.last) then
14241428 syntaxError(em " misaligned end marker " , Span (start, in.lastCharOffset))
1425- else if overlapsPatch(source, Span (start, start)) then
1426- patch(source, Span (start, start), " " )
1427- patch(source, Span (start, in.lastCharOffset), s " } // end $endName" )
14281429 in.token = IDENTIFIER // Leaving it as the original token can confuse newline insertion
14291430 in.nextToken()
14301431 end checkEndMarker
0 commit comments