@@ -92,7 +92,7 @@ object Scanners {
9292 || token == IDENTIFIER && isOperatorPart(name(name.length - 1 ))
9393
9494 def isArrow =
95- token == ARROW || token == CTXARROW || token == ARROWeol
95+ token == ARROW || token == CTXARROW
9696 }
9797
9898 abstract class ScannerCommon (source : SourceFile )(using Context ) extends CharArrayReader with TokenData {
@@ -612,11 +612,7 @@ object Scanners {
612612 insert(if (pastBlankLine) NEWLINES else NEWLINE , lineOffset)
613613 else if indentIsSignificant then
614614 if nextWidth < lastWidth
615- || nextWidth == lastWidth
616- && indentPrefix.match
617- case MATCH | CATCH => token != CASE
618- case _ => false
619- then
615+ || nextWidth == lastWidth && (indentPrefix == MATCH || indentPrefix == CATCH ) && token != CASE then
620616 if currentRegion.isOutermost then
621617 if nextWidth < lastWidth then currentRegion = topLevelRegion(nextWidth)
622618 else if ! isLeadingInfixOperator(nextWidth) && ! statCtdTokens.contains(lastToken) && lastToken != INDENT then
@@ -643,12 +639,7 @@ object Scanners {
643639 else if r.isInstanceOf [InBraces ] && ! closingRegionTokens.contains(token) then
644640 report.warning(" Line is indented too far to the left, or a `}` is missing" , sourcePos())
645641 else if lastWidth < nextWidth
646- || lastWidth == nextWidth
647- && lastToken.match
648- case MATCH | CATCH => token == CASE
649- case ARROWeol => true
650- case _ => false
651- then
642+ || lastWidth == nextWidth && (lastToken == MATCH || lastToken == CATCH ) && token == CASE then
652643 if canStartIndentTokens.contains(lastToken) then
653644 currentRegion = Indented (nextWidth, lastToken, currentRegion)
654645 insert(INDENT , offset)
@@ -680,12 +671,19 @@ object Scanners {
680671 reset()
681672 if atEOL then token = COLONeol
682673
683- def observeArrowEOL (): Unit =
684- if indentSyntax && token == ARROW then
674+ // consume => and insert <indent> if applicable
675+ def observeArrowIndented (): Unit =
676+ if isArrow && indentSyntax then
685677 peekAhead()
686678 val atEOL = isAfterLineEnd || token == EOF
687679 reset()
688- if atEOL then token = ARROWeol
680+ if atEOL then
681+ val nextWidth = indentWidth(next.offset)
682+ val lastWidth = currentRegion.indentWidth
683+ if lastWidth < nextWidth then
684+ currentRegion = Indented (nextWidth, COLONeol , currentRegion)
685+ offset = next.offset
686+ token = INDENT
689687
690688 def observeIndented (): Unit =
691689 if indentSyntax && isNewLine then
0 commit comments