@@ -328,6 +328,13 @@ object Parsers {
328
328
if in.token == token then in.nextToken()
329
329
offset
330
330
331
+ def accept (token : Int , help : String ): Int =
332
+ val offset = in.offset
333
+ if in.token != token then
334
+ syntaxErrorOrIncomplete(ExpectedTokenButFound (token, in.token, suffix = help))
335
+ if in.token == token then in.nextToken()
336
+ offset
337
+
331
338
def accept (name : Name ): Int = {
332
339
val offset = in.offset
333
340
if ! isIdent(name) then
@@ -4012,7 +4019,7 @@ object Parsers {
4012
4019
lhs match
4013
4020
case Ident (name) :: Nil if name.endsWith(" :" ) =>
4014
4021
val help = i " ; identifier ends in colon, did you mean ` ${name.toSimpleName.dropRight(1 )}`: in backticks? "
4015
- syntaxErrorOrIncomplete( ExpectedTokenButFound ( EQUALS , in.token, suffix = help) )
4022
+ accept( EQUALS , help)
4016
4023
case _ => accept(EQUALS )
4017
4024
else
4018
4025
accept(EQUALS )
@@ -4115,7 +4122,7 @@ object Parsers {
4115
4122
else EmptyTree
4116
4123
else if in.token == IDENTIFIER && paramss.isEmpty && name.endsWith(" :" ) then
4117
4124
val help = i " ; identifier ends in colon, did you mean ` ${name.toSimpleName.dropRight(1 )}`: in backticks? "
4118
- syntaxErrorOrIncomplete( ExpectedTokenButFound ( EQUALS , in.token, suffix = help) )
4125
+ accept( EQUALS , help)
4119
4126
EmptyTree
4120
4127
else
4121
4128
if (! isExprIntro) syntaxError(MissingReturnType (), in.lastOffset)
0 commit comments