Bug #1489
Unhelpful error message for package followed by identifier (without dollar sign)
Description
The following produces a misleading error message
package abc; --> ERROR: I was expecting a package name but I've found the keyword "abc" --> package abc; --> ^^^
The point being that
package
expects to be followed by a dollar sign.I don't know why it thinks that
abc
is a keyword?!?
History
#1 Updated by John Abbott over 3 years ago
It looks like the error mesg was generated by Parser.H:159
.
There is also a comment in the code referring to #673.
#2 Updated by John Abbott over 3 years ago
- Status changed from New to Resolved
- Assignee set to John Abbott
- Target version changed from CoCoA-5.4.2 to CoCoA-5.4.0
- % Done changed from 0 to 70
It seems that the root cause was in LexemeClass
... which was poorly written (by me?).
I have rewritten it, and all seems to be OK now.
- (1) work OK on correct input (i.e.
export $name
) - (2) gives helpful error mesg for incorrect input: namely
package
followed by keyword, string literal, number, identifier, symbol, EOF.
#3 Updated by John Abbott over 3 years ago
- % Done changed from 70 to 80
I have added some tests to a new file called test-package.cocoa5
.
Not yet checked in: awaiting comments on #1495 about what err mesgs should be produced.
#4 Updated by Anna Maria Bigatti over 3 years ago
John Abbott wrote:
I have added some tests to a new file called
test-package.cocoa5
.
Not yet checked in: awaiting comments on #1495 about what err mesgs should be produced.
(why #1495?)
I was caught a feew times by this error: I forgot the need of "$".
I changed the definition in Parser.C (as for other humanReadable strings) so now says so:
I was expecting a package name ("$PkgName") but I've found the keyword "abc"
#5 Updated by John Abbott over 3 years ago
- Status changed from Resolved to Closed
- % Done changed from 80 to 100
- Estimated time set to 1.99 h