better error message for invalid module names

This commit is contained in:
Araq 2011-04-16 09:11:24 +02:00
commit e487c0a249
4 changed files with 5 additions and 19 deletions

View file

@ -56,7 +56,7 @@ proc newModule(filename: string): PSym =
result.kind = skModule
result.name = getIdent(splitFile(filename).name)
if not isNimrodIdentifier(result.name.s):
rawMessage(errIdentifierExpected, result.name.s)
rawMessage(errInvalidModuleName, result.name.s)
result.owner = result # a module belongs to itself
result.info = newLineInfo(filename, 1, 1)

View file

@ -19,6 +19,7 @@ type
errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter,
errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected,
errInvalidModuleName,
errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
errInvalidPragma, errUnknownPragma, errInvalidDirectiveX,
@ -119,6 +120,7 @@ const
errClosingBracketExpected: "closing ']' expected, but end of file reached",
errMissingFinalQuote: "missing final \'",
errIdentifierExpected: "identifier expected, but found \'$1\'",
errInvalidModuleName: "invalid module name: '$1'",
errOperatorExpected: "operator expected, but found \'$1\'",
errTokenExpected: "\'$1\' expected",
errStringAfterIncludeExpected: "string after \'include\' expected",