better error message for invalid module names
This commit is contained in:
parent
cd292568d7
commit
e487c0a249
4 changed files with 5 additions and 19 deletions
|
|
@ -56,7 +56,7 @@ proc newModule(filename: string): PSym =
|
||||||
result.kind = skModule
|
result.kind = skModule
|
||||||
result.name = getIdent(splitFile(filename).name)
|
result.name = getIdent(splitFile(filename).name)
|
||||||
if not isNimrodIdentifier(result.name.s):
|
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.owner = result # a module belongs to itself
|
||||||
result.info = newLineInfo(filename, 1, 1)
|
result.info = newLineInfo(filename, 1, 1)
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ type
|
||||||
errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
|
errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
|
||||||
errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter,
|
errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter,
|
||||||
errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected,
|
errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected,
|
||||||
|
errInvalidModuleName,
|
||||||
errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
|
errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
|
||||||
errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
|
errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
|
||||||
errInvalidPragma, errUnknownPragma, errInvalidDirectiveX,
|
errInvalidPragma, errUnknownPragma, errInvalidDirectiveX,
|
||||||
|
|
@ -119,6 +120,7 @@ const
|
||||||
errClosingBracketExpected: "closing ']' expected, but end of file reached",
|
errClosingBracketExpected: "closing ']' expected, but end of file reached",
|
||||||
errMissingFinalQuote: "missing final \'",
|
errMissingFinalQuote: "missing final \'",
|
||||||
errIdentifierExpected: "identifier expected, but found \'$1\'",
|
errIdentifierExpected: "identifier expected, but found \'$1\'",
|
||||||
|
errInvalidModuleName: "invalid module name: '$1'",
|
||||||
errOperatorExpected: "operator expected, but found \'$1\'",
|
errOperatorExpected: "operator expected, but found \'$1\'",
|
||||||
errTokenExpected: "\'$1\' expected",
|
errTokenExpected: "\'$1\' expected",
|
||||||
errStringAfterIncludeExpected: "string after \'include\' expected",
|
errStringAfterIncludeExpected: "string after \'include\' expected",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
=======================================================
|
=======================================================
|
||||||
The Nimrod Compiler
|
The Nimrod Compiler
|
||||||
Copyright (C) 2004-2010 Andreas Rumpf
|
Copyright (C) 2004-2011 Andreas Rumpf
|
||||||
=======================================================
|
=======================================================
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
|
|
|
||||||
18
koch.nim
18
koch.nim
|
|
@ -33,7 +33,6 @@ Possible Commands:
|
||||||
csource [options] builds the C sources for installation
|
csource [options] builds the C sources for installation
|
||||||
zip builds the installation ZIP package
|
zip builds the installation ZIP package
|
||||||
inno [options] builds the Inno Setup installer
|
inno [options] builds the Inno Setup installer
|
||||||
git removes and adds generated C files to git
|
|
||||||
Boot options:
|
Boot options:
|
||||||
-d:release produce a release version of the compiler
|
-d:release produce a release version of the compiler
|
||||||
-d:tinyc include the Tiny C backend (not supported on Windows)
|
-d:tinyc include the Tiny C backend (not supported on Windows)
|
||||||
|
|
@ -77,17 +76,6 @@ proc web(args: string) =
|
||||||
exec("nimrod cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" %
|
exec("nimrod cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" %
|
||||||
NimrodVersion)
|
NimrodVersion)
|
||||||
|
|
||||||
proc gitAux(dir: string) =
|
|
||||||
for kind, path in walkDir(dir):
|
|
||||||
if kind == pcDir:
|
|
||||||
var cfiles = path / "*.c"
|
|
||||||
when false: exec("git rm " & cfiles)
|
|
||||||
exec("git add " & cfiles)
|
|
||||||
gitAux(path)
|
|
||||||
|
|
||||||
proc git =
|
|
||||||
gitAux("build")
|
|
||||||
|
|
||||||
# -------------- boot ---------------------------------------------------------
|
# -------------- boot ---------------------------------------------------------
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
@ -97,10 +85,7 @@ proc findStartNimrod: string =
|
||||||
# we try several things before giving up:
|
# we try several things before giving up:
|
||||||
# * bin/nimrod
|
# * bin/nimrod
|
||||||
# * $PATH/nimrod
|
# * $PATH/nimrod
|
||||||
# * bin/nim
|
# If these fail, we try to build nimrod with the "build.(sh|bat)" script.
|
||||||
# If these fail, we build nimrod with the "build.sh" script
|
|
||||||
# (but only on UNIX). Otherwise we try to compile "nim" with FPC
|
|
||||||
# and use "bin/nim".
|
|
||||||
var nimrod = "nimrod".exe
|
var nimrod = "nimrod".exe
|
||||||
result = "bin" / nimrod
|
result = "bin" / nimrod
|
||||||
if ExistsFile(result): return
|
if ExistsFile(result): return
|
||||||
|
|
@ -204,7 +189,6 @@ of cmdArgument:
|
||||||
of "zip": zip(op.cmdLineRest)
|
of "zip": zip(op.cmdLineRest)
|
||||||
of "inno": inno(op.cmdLineRest)
|
of "inno": inno(op.cmdLineRest)
|
||||||
of "install": install(op.cmdLineRest)
|
of "install": install(op.cmdLineRest)
|
||||||
of "git": git()
|
|
||||||
else: showHelp()
|
else: showHelp()
|
||||||
of cmdEnd: showHelp()
|
of cmdEnd: showHelp()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue