Closed apblack closed 11 months ago
This one is quite similar:
constantScope.grace[102:9]: Syntax error: a sequence beginning with a '[' must end with a ']'.
101: obj::graceObjectAttributes,
102: bool:booleanAttributes,
--------------^
Here the parser found the reserved token :
while it was looking for the rest of an expression.
Can we manage a message like
I was expecting an expression, but found the reserved token
:
or
I was expecting a parameter name, but found the reserved token
class
The first example was fixed (with the help of @geeksam) in commit 580ad15ba0b1fce058da915a2b3a81173ca5a3b9. When an identifier is expected but not found, the parser not explicitly checks for a reserved word, and tells the user that the reserved word cannot be used as identifier.
The second example is not fixed, and I'm not clear how it might be. As opposed to the case where one is parsing a parameter list, a sequence constructor contains arbitrary expressions, and saying that a close bracket was expected may be the best we can do.
I got this error message:
The problem is that the parser found the reserved word
class
while it was looking for an identifier. But the message doesn't say this.