Skip to content

Commit 3f1d83f

Browse files
oderskyneko-kai
authored andcommitted
Fixes for handling end marker
- Only recognize it under indentSyntax - But include it as a possible statement start even under Scala 2. END might be detected before it can be converted back to IDENTIFIER. So it needs to be included in canStartStatement2, just like IDENTIFIER.
1 parent 1840a5d commit 3f1d83f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/parsing/Scanners.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ object Scanners {
671671
}
672672

673673
protected def isEndMarker: Boolean =
674-
if isAfterLineEnd then
674+
if indentSyntax && isAfterLineEnd then
675675
val endLine = source.offsetToLine(offset)
676676
val lookahead = new LookaheadScanner():
677677
override def isEndMarker = false

compiler/src/dotty/tools/dotc/parsing/Tokens.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ object Tokens extends TokensCommon {
255255
final val mustStartStatTokens: TokenSet = defIntroTokens | modifierTokens | BitSet(IMPORT, EXPORT, PACKAGE)
256256

257257
final val canStartStatTokens2: TokenSet = canStartExprTokens2 | mustStartStatTokens | BitSet(
258-
AT, CASE)
258+
AT, CASE, END) // END is included since it might be tested before being converted back to IDENTIFIER
259259
final val canStartStatTokens3: TokenSet = canStartExprTokens3 | mustStartStatTokens | BitSet(
260260
AT, CASE, END)
261261

0 commit comments

Comments
 (0)