aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-08 21:10:58 +1100
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:20:45 +0200
commitfe14afb67ecfeef0c7d6bc6588a1ec1c04b21fb8 (patch)
tree0c236f39f0496553b988b329e10c44639220e7eb /compiler/src/dotty/tools/dotc/parsing/Scanners.scala
parentca039bae393a1d32720d6517baae434b91eefefd (diff)
downloaddotty-fe14afb67ecfeef0c7d6bc6588a1ec1c04b21fb8.tar.gz
dotty-fe14afb67ecfeef0c7d6bc6588a1ec1c04b21fb8.tar.bz2
dotty-fe14afb67ecfeef0c7d6bc6588a1ec1c04b21fb8.zip
Simplify syntax
`enum' only allowed as a prefix of classes, dropped from traits and objects.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/parsing/Scanners.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/parsing/Scanners.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
index 847f600c0..4b1d02093 100644
--- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
@@ -294,7 +294,10 @@ object Scanners {
if (!sepRegions.isEmpty && sepRegions.head == lastToken)
sepRegions = sepRegions.tail
case ARROW =>
- if (!sepRegions.isEmpty && sepRegions.head == lastToken)
+ if (!sepRegions.isEmpty && sepRegions.head == ARROW)
+ sepRegions = sepRegions.tail
+ case EXTENDS =>
+ if (!sepRegions.isEmpty && sepRegions.head == ARROW)
sepRegions = sepRegions.tail
case STRINGLIT =>
if (inMultiLineInterpolation)
@@ -330,7 +333,8 @@ object Scanners {
if (isAfterLineEnd() &&
(canEndStatTokens contains lastToken) &&
(canStartStatTokens contains token) &&
- (sepRegions.isEmpty || sepRegions.head == RBRACE)) {
+ (sepRegions.isEmpty || sepRegions.head == RBRACE ||
+ sepRegions.head == ARROW && token == CASE)) {
next copyFrom this
// todo: make offset line-end of previous line?
offset = if (lineStartOffset <= offset) lineStartOffset else lastLineStartOffset