@@ -944,7 +944,7 @@ object Parsers {
944
944
lookahead.isArrow
945
945
&& {
946
946
lookahead.nextToken()
947
- lookahead.token == INDENT
947
+ lookahead.token == INDENT || lookahead.token == EOF
948
948
}
949
949
lookahead.nextToken()
950
950
if lookahead.isIdent || lookahead.token == USCORE then
@@ -1340,11 +1340,16 @@ object Parsers {
1340
1340
// note: next is defined here because current == NEWLINE
1341
1341
if (in.token == NEWLINE && p(in.next.token)) newLineOpt()
1342
1342
1343
- def colonAtEOLOpt (): Unit = {
1343
+ def acceptIndent () =
1344
+ if in.token != INDENT then
1345
+ syntaxErrorOrIncomplete(em " indented definitions expected, ${in} found " )
1346
+
1347
+ def colonAtEOLOpt (): Unit =
1344
1348
possibleColonOffset = in.lastOffset
1345
1349
in.observeColonEOL(inTemplate = false )
1346
- if in.token == COLONeol then in.nextToken()
1347
- }
1350
+ if in.token == COLONeol then
1351
+ in.nextToken()
1352
+ acceptIndent()
1348
1353
1349
1354
def argumentStart (): Unit =
1350
1355
colonAtEOLOpt()
@@ -1364,8 +1369,7 @@ object Parsers {
1364
1369
if in.lookahead.token == END then in.token = NEWLINE
1365
1370
else
1366
1371
in.nextToken()
1367
- if in.token != INDENT && in.token != LBRACE then
1368
- syntaxErrorOrIncomplete(em " indented definitions expected, ${in} found " )
1372
+ if in.token != LBRACE then acceptIndent()
1369
1373
else
1370
1374
newLineOptWhenFollowedBy(LBRACE )
1371
1375
0 commit comments