This commit is contained in:
Araq 2015-03-12 12:17:08 +01:00
commit aa175e9e57
3 changed files with 339 additions and 336 deletions

View file

@ -58,7 +58,7 @@ proc commandCompileToC =
registerPass(cgenPass) registerPass(cgenPass)
rodPass() rodPass()
#registerPass(cleanupPass()) #registerPass(cleanupPass())
compileProject() compileProject()
cgenWriteModules() cgenWriteModules()
if gCmd != cmdRun: if gCmd != cmdRun:
@ -363,7 +363,9 @@ proc mainCommand* =
gVerbosity > 0): gVerbosity > 0):
rawMessage(hintSuccessX, [$gLinesCompiled, rawMessage(hintSuccessX, [$gLinesCompiled,
formatFloat(epochTime() - gLastCmdTime, ffDecimal, 3), formatFloat(epochTime() - gLastCmdTime, ffDecimal, 3),
formatSize(getTotalMem())]) formatSize(getTotalMem()),
if condSyms.isDefined("release"): "Release Build"
else: "Debug Build"])
when PrintRopeCacheStats: when PrintRopeCacheStats:
echo "rope cache stats: " echo "rope cache stats: "

View file

@ -10,95 +10,95 @@
import import
options, strutils, os, tables, ropes, platform options, strutils, os, tables, ropes, platform
type type
TMsgKind* = enum TMsgKind* = enum
errUnknown, errIllFormedAstX, errInternal, errCannotOpenFile, errGenerated, errUnknown, errIllFormedAstX, errInternal, errCannotOpenFile, errGenerated,
errXCompilerDoesNotSupportCpp, errStringLiteralExpected, errXCompilerDoesNotSupportCpp, errStringLiteralExpected,
errIntLiteralExpected, errInvalidCharacterConstant, errIntLiteralExpected, errInvalidCharacterConstant,
errClosingTripleQuoteExpected, errClosingQuoteExpected, errClosingTripleQuoteExpected, errClosingQuoteExpected,
errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong, errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter, errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter,
errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected, errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected,
errNewlineExpected, errNewlineExpected,
errInvalidModuleName, errInvalidModuleName,
errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected, errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected, errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
errInvalidPragma, errUnknownPragma, errInvalidDirectiveX, errInvalidPragma, errUnknownPragma, errInvalidDirectiveX,
errAtPopWithoutPush, errEmptyAsm, errInvalidIndentation, errAtPopWithoutPush, errEmptyAsm, errInvalidIndentation,
errExceptionExpected, errExceptionAlreadyHandled, errExceptionExpected, errExceptionAlreadyHandled,
errYieldNotAllowedHere, errYieldNotAllowedInTryStmt, errYieldNotAllowedHere, errYieldNotAllowedInTryStmt,
errInvalidNumberOfYieldExpr, errCannotReturnExpr, errAttemptToRedefine, errInvalidNumberOfYieldExpr, errCannotReturnExpr, errAttemptToRedefine,
errStmtInvalidAfterReturn, errStmtExpected, errInvalidLabel, errStmtInvalidAfterReturn, errStmtExpected, errInvalidLabel,
errInvalidCmdLineOption, errCmdLineArgExpected, errCmdLineNoArgExpected, errInvalidCmdLineOption, errCmdLineArgExpected, errCmdLineNoArgExpected,
errInvalidVarSubstitution, errUnknownVar, errUnknownCcompiler, errInvalidVarSubstitution, errUnknownVar, errUnknownCcompiler,
errOnOrOffExpectedButXFound, errNoneBoehmRefcExpectedButXFound, errOnOrOffExpectedButXFound, errNoneBoehmRefcExpectedButXFound,
errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound, errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound,
errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound, errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound,
errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected, errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected,
errExprExpected, errUndeclaredIdentifier, errUseQualifier, errTypeExpected, errExprExpected, errUndeclaredIdentifier, errUseQualifier, errTypeExpected,
errSystemNeeds, errExecutionOfProgramFailed, errNotOverloadable, errSystemNeeds, errExecutionOfProgramFailed, errNotOverloadable,
errInvalidArgForX, errStmtHasNoEffect, errXExpectsTypeOrValue, errInvalidArgForX, errStmtHasNoEffect, errXExpectsTypeOrValue,
errXExpectsArrayType, errIteratorCannotBeInstantiated, errExprXAmbiguous, errXExpectsArrayType, errIteratorCannotBeInstantiated, errExprXAmbiguous,
errConstantDivisionByZero, errOrdinalTypeExpected, errConstantDivisionByZero, errOrdinalTypeExpected,
errOrdinalOrFloatTypeExpected, errOverOrUnderflow, errOrdinalOrFloatTypeExpected, errOverOrUnderflow,
errCannotEvalXBecauseIncompletelyDefined, errChrExpectsRange0_255, errCannotEvalXBecauseIncompletelyDefined, errChrExpectsRange0_255,
errDynlibRequiresExportc, errUndeclaredFieldX, errNilAccess, errDynlibRequiresExportc, errUndeclaredFieldX, errNilAccess,
errIndexOutOfBounds, errIndexTypesDoNotMatch, errBracketsInvalidForType, errIndexOutOfBounds, errIndexTypesDoNotMatch, errBracketsInvalidForType,
errValueOutOfSetBounds, errFieldInitTwice, errFieldNotInit, errValueOutOfSetBounds, errFieldInitTwice, errFieldNotInit,
errExprXCannotBeCalled, errExprHasNoType, errExprXHasNoType, errExprXCannotBeCalled, errExprHasNoType, errExprXHasNoType,
errCastNotInSafeMode, errExprCannotBeCastedToX, errCommaOrParRiExpected, errCastNotInSafeMode, errExprCannotBeCastedToX, errCommaOrParRiExpected,
errCurlyLeOrParLeExpected, errSectionExpected, errRangeExpected, errCurlyLeOrParLeExpected, errSectionExpected, errRangeExpected,
errMagicOnlyInSystem, errPowerOfTwoExpected, errMagicOnlyInSystem, errPowerOfTwoExpected,
errStringMayNotBeEmpty, errCallConvExpected, errProcOnlyOneCallConv, errStringMayNotBeEmpty, errCallConvExpected, errProcOnlyOneCallConv,
errSymbolMustBeImported, errExprMustBeBool, errConstExprExpected, errSymbolMustBeImported, errExprMustBeBool, errConstExprExpected,
errDuplicateCaseLabel, errRangeIsEmpty, errSelectorMustBeOfCertainTypes, errDuplicateCaseLabel, errRangeIsEmpty, errSelectorMustBeOfCertainTypes,
errSelectorMustBeOrdinal, errOrdXMustNotBeNegative, errLenXinvalid, errSelectorMustBeOrdinal, errOrdXMustNotBeNegative, errLenXinvalid,
errWrongNumberOfVariables, errExprCannotBeRaised, errBreakOnlyInLoop, errWrongNumberOfVariables, errExprCannotBeRaised, errBreakOnlyInLoop,
errTypeXhasUnknownSize, errConstNeedsConstExpr, errConstNeedsValue, errTypeXhasUnknownSize, errConstNeedsConstExpr, errConstNeedsValue,
errResultCannotBeOpenArray, errSizeTooBig, errSetTooBig, errResultCannotBeOpenArray, errSizeTooBig, errSetTooBig,
errBaseTypeMustBeOrdinal, errInheritanceOnlyWithNonFinalObjects, errBaseTypeMustBeOrdinal, errInheritanceOnlyWithNonFinalObjects,
errInheritanceOnlyWithEnums, errIllegalRecursionInTypeX, errInheritanceOnlyWithEnums, errIllegalRecursionInTypeX,
errCannotInstantiateX, errExprHasNoAddress, errXStackEscape, errCannotInstantiateX, errExprHasNoAddress, errXStackEscape,
errVarForOutParamNeeded, errVarForOutParamNeeded,
errPureTypeMismatch, errTypeMismatch, errButExpected, errButExpectedX, errPureTypeMismatch, errTypeMismatch, errButExpected, errButExpectedX,
errAmbiguousCallXYZ, errWrongNumberOfArguments, errAmbiguousCallXYZ, errWrongNumberOfArguments,
errXCannotBePassedToProcVar, errXCannotBePassedToProcVar,
errXCannotBeInParamDecl, errPragmaOnlyInHeaderOfProc, errImplOfXNotAllowed, errXCannotBeInParamDecl, errPragmaOnlyInHeaderOfProc, errImplOfXNotAllowed,
errImplOfXexpected, errNoSymbolToBorrowFromFound, errDiscardValueX, errImplOfXexpected, errNoSymbolToBorrowFromFound, errDiscardValueX,
errInvalidDiscard, errIllegalConvFromXtoY, errCannotBindXTwice, errInvalidDiscard, errIllegalConvFromXtoY, errCannotBindXTwice,
errInvalidOrderInArrayConstructor, errInvalidOrderInArrayConstructor,
errInvalidOrderInEnumX, errEnumXHasHoles, errExceptExpected, errInvalidTry, errInvalidOrderInEnumX, errEnumXHasHoles, errExceptExpected, errInvalidTry,
errOptionExpected, errXisNoLabel, errNotAllCasesCovered, errOptionExpected, errXisNoLabel, errNotAllCasesCovered,
errUnknownSubstitionVar, errComplexStmtRequiresInd, errXisNotCallable, errUnknownSubstitionVar, errComplexStmtRequiresInd, errXisNotCallable,
errNoPragmasAllowedForX, errNoGenericParamsAllowedForX, errNoPragmasAllowedForX, errNoGenericParamsAllowedForX,
errInvalidParamKindX, errDefaultArgumentInvalid, errNamedParamHasToBeIdent, errInvalidParamKindX, errDefaultArgumentInvalid, errNamedParamHasToBeIdent,
errNoReturnTypeForX, errConvNeedsOneArg, errInvalidPragmaX, errNoReturnTypeForX, errConvNeedsOneArg, errInvalidPragmaX,
errXNotAllowedHere, errInvalidControlFlowX, errXNotAllowedHere, errInvalidControlFlowX,
errXisNoType, errCircumNeedsPointer, errInvalidExpression, errXisNoType, errCircumNeedsPointer, errInvalidExpression,
errInvalidExpressionX, errEnumHasNoValueX, errNamedExprExpected, errInvalidExpressionX, errEnumHasNoValueX, errNamedExprExpected,
errNamedExprNotAllowed, errXExpectsOneTypeParam, errNamedExprNotAllowed, errXExpectsOneTypeParam,
errArrayExpectsTwoTypeParams, errInvalidVisibilityX, errInitHereNotAllowed, errArrayExpectsTwoTypeParams, errInvalidVisibilityX, errInitHereNotAllowed,
errXCannotBeAssignedTo, errIteratorNotAllowed, errXNeedsReturnType, errXCannotBeAssignedTo, errIteratorNotAllowed, errXNeedsReturnType,
errNoReturnTypeDeclared, errNoReturnTypeDeclared,
errInvalidCommandX, errXOnlyAtModuleScope, errInvalidCommandX, errXOnlyAtModuleScope,
errXNeedsParamObjectType, errXNeedsParamObjectType,
errTemplateInstantiationTooNested, errInstantiationFrom, errTemplateInstantiationTooNested, errInstantiationFrom,
errInvalidIndexValueForTuple, errCommandExpectsFilename, errInvalidIndexValueForTuple, errCommandExpectsFilename,
errMainModuleMustBeSpecified, errMainModuleMustBeSpecified,
errXExpected, errXExpected,
errTIsNotAConcreteType, errTIsNotAConcreteType,
errInvalidSectionStart, errGridTableNotImplemented, errGeneralParseError, errInvalidSectionStart, errGridTableNotImplemented, errGeneralParseError,
errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile, errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile,
errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitly, errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitly,
errOnlyACallOpCanBeDelegator, errUsingNoSymbol, errOnlyACallOpCanBeDelegator, errUsingNoSymbol,
errMacroBodyDependsOnGenericTypes, errMacroBodyDependsOnGenericTypes,
errDestructorNotGenericEnough, errDestructorNotGenericEnough,
errInlineIteratorsAsProcParams, errInlineIteratorsAsProcParams,
errXExpectsTwoArguments, errXExpectsTwoArguments,
errXExpectsObjectTypes, errXcanNeverBeOfThisSubtype, errTooManyIterations, errXExpectsObjectTypes, errXcanNeverBeOfThisSubtype, errTooManyIterations,
errCannotInterpretNodeX, errFieldXNotFound, errInvalidConversionFromTypeX, errCannotInterpretNodeX, errFieldXNotFound, errInvalidConversionFromTypeX,
errAssertionFailed, errCannotGenerateCodeForX, errXRequiresOneArgument, errAssertionFailed, errCannotGenerateCodeForX, errXRequiresOneArgument,
errUnhandledExceptionX, errCyclicTree, errXisNoMacroOrTemplate, errUnhandledExceptionX, errCyclicTree, errXisNoMacroOrTemplate,
errXhasSideEffects, errIteratorExpected, errLetNeedsInit, errXhasSideEffects, errIteratorExpected, errLetNeedsInit,
errThreadvarCannotInit, errWrongSymbolX, errIllegalCaptureX, errThreadvarCannotInit, errWrongSymbolX, errIllegalCaptureX,
errXCannotBeClosure, errXMustBeCompileTime, errXCannotBeClosure, errXMustBeCompileTime,
@ -107,15 +107,15 @@ type
errGenericLambdaNotAllowed, errGenericLambdaNotAllowed,
errCompilerDoesntSupportTarget, errCompilerDoesntSupportTarget,
errUser, errUser,
warnCannotOpenFile, warnCannotOpenFile,
warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit, warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit,
warnDeprecated, warnConfigDeprecated, warnDeprecated, warnConfigDeprecated,
warnSmallLshouldNotBeUsed, warnUnknownMagic, warnRedefinitionOfLabel, warnSmallLshouldNotBeUsed, warnUnknownMagic, warnRedefinitionOfLabel,
warnUnknownSubstitutionX, warnLanguageXNotSupported, warnUnknownSubstitutionX, warnLanguageXNotSupported,
warnFieldXNotSupported, warnCommentXIgnored, warnFieldXNotSupported, warnCommentXIgnored,
warnNilStatement, warnTypelessParam, warnNilStatement, warnTypelessParam,
warnDifferentHeaps, warnWriteToForeignHeap, warnUnsafeCode, warnDifferentHeaps, warnWriteToForeignHeap, warnUnsafeCode,
warnEachIdentIsTuple, warnShadowIdent, warnEachIdentIsTuple, warnShadowIdent,
warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2, warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2,
warnUninit, warnGcMem, warnDestructor, warnLockLevel, warnResultShadowed, warnUninit, warnGcMem, warnDestructor, warnLockLevel, warnResultShadowed,
warnUser, warnUser,
@ -126,205 +126,205 @@ type
hintConditionAlwaysTrue, hintName, hintPattern, hintConditionAlwaysTrue, hintName, hintPattern,
hintUser hintUser
const const
MsgKindToStr*: array[TMsgKind, string] = [ MsgKindToStr*: array[TMsgKind, string] = [
errUnknown: "unknown error", errUnknown: "unknown error",
errIllFormedAstX: "illformed AST: $1", errIllFormedAstX: "illformed AST: $1",
errInternal: "internal error: $1", errInternal: "internal error: $1",
errCannotOpenFile: "cannot open \'$1\'", errCannotOpenFile: "cannot open \'$1\'",
errGenerated: "$1", errGenerated: "$1",
errXCompilerDoesNotSupportCpp: "\'$1\' compiler does not support C++", errXCompilerDoesNotSupportCpp: "\'$1\' compiler does not support C++",
errStringLiteralExpected: "string literal expected", errStringLiteralExpected: "string literal expected",
errIntLiteralExpected: "integer literal expected", errIntLiteralExpected: "integer literal expected",
errInvalidCharacterConstant: "invalid character constant", errInvalidCharacterConstant: "invalid character constant",
errClosingTripleQuoteExpected: "closing \"\"\" expected, but end of file reached", errClosingTripleQuoteExpected: "closing \"\"\" expected, but end of file reached",
errClosingQuoteExpected: "closing \" expected", errClosingQuoteExpected: "closing \" expected",
errTabulatorsAreNotAllowed: "tabulators are not allowed", errTabulatorsAreNotAllowed: "tabulators are not allowed",
errInvalidToken: "invalid token: $1", errInvalidToken: "invalid token: $1",
errLineTooLong: "line too long", errLineTooLong: "line too long",
errInvalidNumber: "$1 is not a valid number", errInvalidNumber: "$1 is not a valid number",
errNumberOutOfRange: "number $1 out of valid range", errNumberOutOfRange: "number $1 out of valid range",
errNnotAllowedInCharacter: "\\n not allowed in character literal", errNnotAllowedInCharacter: "\\n not allowed in character literal",
errClosingBracketExpected: "closing ']' expected, but end of file reached", errClosingBracketExpected: "closing ']' expected, but end of file reached",
errMissingFinalQuote: "missing final \' for character literal", errMissingFinalQuote: "missing final \' for character literal",
errIdentifierExpected: "identifier expected, but found \'$1\'", errIdentifierExpected: "identifier expected, but found \'$1\'",
errNewlineExpected: "newline expected, but found \'$1\'", errNewlineExpected: "newline expected, but found \'$1\'",
errInvalidModuleName: "invalid module name: '$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",
errRecursiveDependencyX: "recursive dependency: \'$1\'", errRecursiveDependencyX: "recursive dependency: \'$1\'",
errOnOrOffExpected: "\'on\' or \'off\' expected", errOnOrOffExpected: "\'on\' or \'off\' expected",
errNoneSpeedOrSizeExpected: "\'none\', \'speed\' or \'size\' expected", errNoneSpeedOrSizeExpected: "\'none\', \'speed\' or \'size\' expected",
errInvalidPragma: "invalid pragma", errInvalidPragma: "invalid pragma",
errUnknownPragma: "unknown pragma: \'$1\'", errUnknownPragma: "unknown pragma: \'$1\'",
errInvalidDirectiveX: "invalid directive: \'$1\'", errInvalidDirectiveX: "invalid directive: \'$1\'",
errAtPopWithoutPush: "\'pop\' without a \'push\' pragma", errAtPopWithoutPush: "\'pop\' without a \'push\' pragma",
errEmptyAsm: "empty asm statement", errEmptyAsm: "empty asm statement",
errInvalidIndentation: "invalid indentation", errInvalidIndentation: "invalid indentation",
errExceptionExpected: "exception expected", errExceptionExpected: "exception expected",
errExceptionAlreadyHandled: "exception already handled", errExceptionAlreadyHandled: "exception already handled",
errYieldNotAllowedHere: "'yield' only allowed in an iterator", errYieldNotAllowedHere: "'yield' only allowed in an iterator",
errYieldNotAllowedInTryStmt: "'yield' cannot be used within 'try' in a non-inlined iterator", errYieldNotAllowedInTryStmt: "'yield' cannot be used within 'try' in a non-inlined iterator",
errInvalidNumberOfYieldExpr: "invalid number of \'yield\' expressions", errInvalidNumberOfYieldExpr: "invalid number of \'yield\' expressions",
errCannotReturnExpr: "current routine cannot return an expression", errCannotReturnExpr: "current routine cannot return an expression",
errAttemptToRedefine: "redefinition of \'$1\'", errAttemptToRedefine: "redefinition of \'$1\'",
errStmtInvalidAfterReturn: "statement not allowed after \'return\', \'break\', \'raise\' or \'continue'", errStmtInvalidAfterReturn: "statement not allowed after \'return\', \'break\', \'raise\' or \'continue'",
errStmtExpected: "statement expected", errStmtExpected: "statement expected",
errInvalidLabel: "\'$1\' is no label", errInvalidLabel: "\'$1\' is no label",
errInvalidCmdLineOption: "invalid command line option: \'$1\'", errInvalidCmdLineOption: "invalid command line option: \'$1\'",
errCmdLineArgExpected: "argument for command line option expected: \'$1\'", errCmdLineArgExpected: "argument for command line option expected: \'$1\'",
errCmdLineNoArgExpected: "invalid argument for command line option: \'$1\'", errCmdLineNoArgExpected: "invalid argument for command line option: \'$1\'",
errInvalidVarSubstitution: "invalid variable substitution in \'$1\'", errInvalidVarSubstitution: "invalid variable substitution in \'$1\'",
errUnknownVar: "unknown variable: \'$1\'", errUnknownVar: "unknown variable: \'$1\'",
errUnknownCcompiler: "unknown C compiler: \'$1\'", errUnknownCcompiler: "unknown C compiler: \'$1\'",
errOnOrOffExpectedButXFound: "\'on\' or \'off\' expected, but \'$1\' found", errOnOrOffExpectedButXFound: "\'on\' or \'off\' expected, but \'$1\' found",
errNoneBoehmRefcExpectedButXFound: "'none', 'boehm' or 'refc' expected, but '$1' found", errNoneBoehmRefcExpectedButXFound: "'none', 'boehm' or 'refc' expected, but '$1' found",
errNoneSpeedOrSizeExpectedButXFound: "'none', 'speed' or 'size' expected, but '$1' found", errNoneSpeedOrSizeExpectedButXFound: "'none', 'speed' or 'size' expected, but '$1' found",
errGuiConsoleOrLibExpectedButXFound: "'gui', 'console' or 'lib' expected, but '$1' found", errGuiConsoleOrLibExpectedButXFound: "'gui', 'console' or 'lib' expected, but '$1' found",
errUnknownOS: "unknown OS: '$1'", errUnknownOS: "unknown OS: '$1'",
errUnknownCPU: "unknown CPU: '$1'", errUnknownCPU: "unknown CPU: '$1'",
errGenOutExpectedButXFound: "'c', 'c++' or 'yaml' expected, but '$1' found", errGenOutExpectedButXFound: "'c', 'c++' or 'yaml' expected, but '$1' found",
errArgsNeedRunOption: "arguments can only be given if the '--run' option is selected", errArgsNeedRunOption: "arguments can only be given if the '--run' option is selected",
errInvalidMultipleAsgn: "multiple assignment is not allowed", errInvalidMultipleAsgn: "multiple assignment is not allowed",
errColonOrEqualsExpected: "\':\' or \'=\' expected, but found \'$1\'", errColonOrEqualsExpected: "\':\' or \'=\' expected, but found \'$1\'",
errExprExpected: "expression expected, but found \'$1\'", errExprExpected: "expression expected, but found \'$1\'",
errUndeclaredIdentifier: "undeclared identifier: \'$1\'", errUndeclaredIdentifier: "undeclared identifier: \'$1\'",
errUseQualifier: "ambiguous identifier: \'$1\' -- use a qualifier", errUseQualifier: "ambiguous identifier: \'$1\' -- use a qualifier",
errTypeExpected: "type expected", errTypeExpected: "type expected",
errSystemNeeds: "system module needs \'$1\'", errSystemNeeds: "system module needs \'$1\'",
errExecutionOfProgramFailed: "execution of an external program failed", errExecutionOfProgramFailed: "execution of an external program failed",
errNotOverloadable: "overloaded \'$1\' leads to ambiguous calls", errNotOverloadable: "overloaded \'$1\' leads to ambiguous calls",
errInvalidArgForX: "invalid argument for \'$1\'", errInvalidArgForX: "invalid argument for \'$1\'",
errStmtHasNoEffect: "statement has no effect", errStmtHasNoEffect: "statement has no effect",
errXExpectsTypeOrValue: "\'$1\' expects a type or value", errXExpectsTypeOrValue: "\'$1\' expects a type or value",
errXExpectsArrayType: "\'$1\' expects an array type", errXExpectsArrayType: "\'$1\' expects an array type",
errIteratorCannotBeInstantiated: "'$1' cannot be instantiated because its body has not been compiled yet", errIteratorCannotBeInstantiated: "'$1' cannot be instantiated because its body has not been compiled yet",
errExprXAmbiguous: "expression '$1' ambiguous in this context", errExprXAmbiguous: "expression '$1' ambiguous in this context",
errConstantDivisionByZero: "division by zero", errConstantDivisionByZero: "division by zero",
errOrdinalTypeExpected: "ordinal type expected", errOrdinalTypeExpected: "ordinal type expected",
errOrdinalOrFloatTypeExpected: "ordinal or float type expected", errOrdinalOrFloatTypeExpected: "ordinal or float type expected",
errOverOrUnderflow: "over- or underflow", errOverOrUnderflow: "over- or underflow",
errCannotEvalXBecauseIncompletelyDefined: "cannot evalutate '$1' because type is not defined completely", errCannotEvalXBecauseIncompletelyDefined: "cannot evalutate '$1' because type is not defined completely",
errChrExpectsRange0_255: "\'chr\' expects an int in the range 0..255", errChrExpectsRange0_255: "\'chr\' expects an int in the range 0..255",
errDynlibRequiresExportc: "\'dynlib\' requires \'exportc\'", errDynlibRequiresExportc: "\'dynlib\' requires \'exportc\'",
errUndeclaredFieldX: "undeclared field: \'$1\'", errUndeclaredFieldX: "undeclared field: \'$1\'",
errNilAccess: "attempt to access a nil address", errNilAccess: "attempt to access a nil address",
errIndexOutOfBounds: "index out of bounds", errIndexOutOfBounds: "index out of bounds",
errIndexTypesDoNotMatch: "index types do not match", errIndexTypesDoNotMatch: "index types do not match",
errBracketsInvalidForType: "\'[]\' operator invalid for this type", errBracketsInvalidForType: "\'[]\' operator invalid for this type",
errValueOutOfSetBounds: "value out of set bounds", errValueOutOfSetBounds: "value out of set bounds",
errFieldInitTwice: "field initialized twice: \'$1\'", errFieldInitTwice: "field initialized twice: \'$1\'",
errFieldNotInit: "field \'$1\' not initialized", errFieldNotInit: "field \'$1\' not initialized",
errExprXCannotBeCalled: "expression \'$1\' cannot be called", errExprXCannotBeCalled: "expression \'$1\' cannot be called",
errExprHasNoType: "expression has no type", errExprHasNoType: "expression has no type",
errExprXHasNoType: "expression \'$1\' has no type (or is ambiguous)", errExprXHasNoType: "expression \'$1\' has no type (or is ambiguous)",
errCastNotInSafeMode: "\'cast\' not allowed in safe mode", errCastNotInSafeMode: "\'cast\' not allowed in safe mode",
errExprCannotBeCastedToX: "expression cannot be casted to $1", errExprCannotBeCastedToX: "expression cannot be casted to $1",
errCommaOrParRiExpected: "',' or ')' expected", errCommaOrParRiExpected: "',' or ')' expected",
errCurlyLeOrParLeExpected: "\'{\' or \'(\' expected", errCurlyLeOrParLeExpected: "\'{\' or \'(\' expected",
errSectionExpected: "section (\'type\', \'proc\', etc.) expected", errSectionExpected: "section (\'type\', \'proc\', etc.) expected",
errRangeExpected: "range expected", errRangeExpected: "range expected",
errMagicOnlyInSystem: "\'magic\' only allowed in system module", errMagicOnlyInSystem: "\'magic\' only allowed in system module",
errPowerOfTwoExpected: "power of two expected", errPowerOfTwoExpected: "power of two expected",
errStringMayNotBeEmpty: "string literal may not be empty", errStringMayNotBeEmpty: "string literal may not be empty",
errCallConvExpected: "calling convention expected", errCallConvExpected: "calling convention expected",
errProcOnlyOneCallConv: "a proc can only have one calling convention", errProcOnlyOneCallConv: "a proc can only have one calling convention",
errSymbolMustBeImported: "symbol must be imported if 'lib' pragma is used", errSymbolMustBeImported: "symbol must be imported if 'lib' pragma is used",
errExprMustBeBool: "expression must be of type 'bool'", errExprMustBeBool: "expression must be of type 'bool'",
errConstExprExpected: "constant expression expected", errConstExprExpected: "constant expression expected",
errDuplicateCaseLabel: "duplicate case label", errDuplicateCaseLabel: "duplicate case label",
errRangeIsEmpty: "range is empty", errRangeIsEmpty: "range is empty",
errSelectorMustBeOfCertainTypes: "selector must be of an ordinal type, float or string", errSelectorMustBeOfCertainTypes: "selector must be of an ordinal type, float or string",
errSelectorMustBeOrdinal: "selector must be of an ordinal type", errSelectorMustBeOrdinal: "selector must be of an ordinal type",
errOrdXMustNotBeNegative: "ord($1) must not be negative", errOrdXMustNotBeNegative: "ord($1) must not be negative",
errLenXinvalid: "len($1) must be less than 32768", errLenXinvalid: "len($1) must be less than 32768",
errWrongNumberOfVariables: "wrong number of variables", errWrongNumberOfVariables: "wrong number of variables",
errExprCannotBeRaised: "only a 'ref object' can be raised", errExprCannotBeRaised: "only a 'ref object' can be raised",
errBreakOnlyInLoop: "'break' only allowed in loop construct", errBreakOnlyInLoop: "'break' only allowed in loop construct",
errTypeXhasUnknownSize: "type \'$1\' has unknown size", errTypeXhasUnknownSize: "type \'$1\' has unknown size",
errConstNeedsConstExpr: "a constant can only be initialized with a constant expression", errConstNeedsConstExpr: "a constant can only be initialized with a constant expression",
errConstNeedsValue: "a constant needs a value", errConstNeedsValue: "a constant needs a value",
errResultCannotBeOpenArray: "the result type cannot be on open array", errResultCannotBeOpenArray: "the result type cannot be on open array",
errSizeTooBig: "computing the type\'s size produced an overflow", errSizeTooBig: "computing the type\'s size produced an overflow",
errSetTooBig: "set is too large", errSetTooBig: "set is too large",
errBaseTypeMustBeOrdinal: "base type of a set must be an ordinal", errBaseTypeMustBeOrdinal: "base type of a set must be an ordinal",
errInheritanceOnlyWithNonFinalObjects: "inheritance only works with non-final objects", errInheritanceOnlyWithNonFinalObjects: "inheritance only works with non-final objects",
errInheritanceOnlyWithEnums: "inheritance only works with an enum", errInheritanceOnlyWithEnums: "inheritance only works with an enum",
errIllegalRecursionInTypeX: "illegal recursion in type \'$1\'", errIllegalRecursionInTypeX: "illegal recursion in type \'$1\'",
errCannotInstantiateX: "cannot instantiate: \'$1\'", errCannotInstantiateX: "cannot instantiate: \'$1\'",
errExprHasNoAddress: "expression has no address", errExprHasNoAddress: "expression has no address",
errXStackEscape: "address of '$1' may not escape its stack frame", errXStackEscape: "address of '$1' may not escape its stack frame",
errVarForOutParamNeeded: "for a \'var\' type a variable needs to be passed", errVarForOutParamNeeded: "for a \'var\' type a variable needs to be passed",
errPureTypeMismatch: "type mismatch", errPureTypeMismatch: "type mismatch",
errTypeMismatch: "type mismatch: got (", errTypeMismatch: "type mismatch: got (",
errButExpected: "but expected one of: ", errButExpected: "but expected one of: ",
errButExpectedX: "but expected \'$1\'", errButExpectedX: "but expected \'$1\'",
errAmbiguousCallXYZ: "ambiguous call; both $1 and $2 match for: $3", errAmbiguousCallXYZ: "ambiguous call; both $1 and $2 match for: $3",
errWrongNumberOfArguments: "wrong number of arguments", errWrongNumberOfArguments: "wrong number of arguments",
errXCannotBePassedToProcVar: "\'$1\' cannot be passed to a procvar", errXCannotBePassedToProcVar: "\'$1\' cannot be passed to a procvar",
errXCannotBeInParamDecl: "$1 cannot be declared in parameter declaration", errXCannotBeInParamDecl: "$1 cannot be declared in parameter declaration",
errPragmaOnlyInHeaderOfProc: "pragmas are only allowed in the header of a proc", errPragmaOnlyInHeaderOfProc: "pragmas are only allowed in the header of a proc",
errImplOfXNotAllowed: "implementation of \'$1\' is not allowed", errImplOfXNotAllowed: "implementation of \'$1\' is not allowed",
errImplOfXexpected: "implementation of \'$1\' expected", errImplOfXexpected: "implementation of \'$1\' expected",
errNoSymbolToBorrowFromFound: "no symbol to borrow from found", errNoSymbolToBorrowFromFound: "no symbol to borrow from found",
errDiscardValueX: "value of type '$1' has to be discarded", errDiscardValueX: "value of type '$1' has to be discarded",
errInvalidDiscard: "statement returns no value that can be discarded", errInvalidDiscard: "statement returns no value that can be discarded",
errIllegalConvFromXtoY: "conversion from $1 to $2 is invalid", errIllegalConvFromXtoY: "conversion from $1 to $2 is invalid",
errCannotBindXTwice: "cannot bind parameter \'$1\' twice", errCannotBindXTwice: "cannot bind parameter \'$1\' twice",
errInvalidOrderInArrayConstructor: "invalid order in array constructor", errInvalidOrderInArrayConstructor: "invalid order in array constructor",
errInvalidOrderInEnumX: "invalid order in enum \'$1\'", errInvalidOrderInEnumX: "invalid order in enum \'$1\'",
errEnumXHasHoles: "enum \'$1\' has holes", errEnumXHasHoles: "enum \'$1\' has holes",
errExceptExpected: "\'except\' or \'finally\' expected", errExceptExpected: "\'except\' or \'finally\' expected",
errInvalidTry: "after catch all \'except\' or \'finally\' no section may follow", errInvalidTry: "after catch all \'except\' or \'finally\' no section may follow",
errOptionExpected: "option expected, but found \'$1\'", errOptionExpected: "option expected, but found \'$1\'",
errXisNoLabel: "\'$1\' is not a label", errXisNoLabel: "\'$1\' is not a label",
errNotAllCasesCovered: "not all cases are covered", errNotAllCasesCovered: "not all cases are covered",
errUnknownSubstitionVar: "unknown substitution variable: \'$1\'", errUnknownSubstitionVar: "unknown substitution variable: \'$1\'",
errComplexStmtRequiresInd: "complex statement requires indentation", errComplexStmtRequiresInd: "complex statement requires indentation",
errXisNotCallable: "\'$1\' is not callable", errXisNotCallable: "\'$1\' is not callable",
errNoPragmasAllowedForX: "no pragmas allowed for $1", errNoPragmasAllowedForX: "no pragmas allowed for $1",
errNoGenericParamsAllowedForX: "no generic parameters allowed for $1", errNoGenericParamsAllowedForX: "no generic parameters allowed for $1",
errInvalidParamKindX: "invalid param kind: \'$1\'", errInvalidParamKindX: "invalid param kind: \'$1\'",
errDefaultArgumentInvalid: "default argument invalid", errDefaultArgumentInvalid: "default argument invalid",
errNamedParamHasToBeIdent: "named parameter has to be an identifier", errNamedParamHasToBeIdent: "named parameter has to be an identifier",
errNoReturnTypeForX: "no return type allowed for $1", errNoReturnTypeForX: "no return type allowed for $1",
errConvNeedsOneArg: "a type conversion needs exactly one argument", errConvNeedsOneArg: "a type conversion needs exactly one argument",
errInvalidPragmaX: "invalid pragma: $1", errInvalidPragmaX: "invalid pragma: $1",
errXNotAllowedHere: "$1 not allowed here", errXNotAllowedHere: "$1 not allowed here",
errInvalidControlFlowX: "invalid control flow: $1", errInvalidControlFlowX: "invalid control flow: $1",
errXisNoType: "invalid type: \'$1\'", errXisNoType: "invalid type: \'$1\'",
errCircumNeedsPointer: "'[]' needs a pointer or reference type", errCircumNeedsPointer: "'[]' needs a pointer or reference type",
errInvalidExpression: "invalid expression", errInvalidExpression: "invalid expression",
errInvalidExpressionX: "invalid expression: \'$1\'", errInvalidExpressionX: "invalid expression: \'$1\'",
errEnumHasNoValueX: "enum has no value \'$1\'", errEnumHasNoValueX: "enum has no value \'$1\'",
errNamedExprExpected: "named expression expected", errNamedExprExpected: "named expression expected",
errNamedExprNotAllowed: "named expression not allowed here", errNamedExprNotAllowed: "named expression not allowed here",
errXExpectsOneTypeParam: "\'$1\' expects one type parameter", errXExpectsOneTypeParam: "\'$1\' expects one type parameter",
errArrayExpectsTwoTypeParams: "array expects two type parameters", errArrayExpectsTwoTypeParams: "array expects two type parameters",
errInvalidVisibilityX: "invalid visibility: \'$1\'", errInvalidVisibilityX: "invalid visibility: \'$1\'",
errInitHereNotAllowed: "initialization not allowed here", errInitHereNotAllowed: "initialization not allowed here",
errXCannotBeAssignedTo: "\'$1\' cannot be assigned to", errXCannotBeAssignedTo: "\'$1\' cannot be assigned to",
errIteratorNotAllowed: "iterators can only be defined at the module\'s top level", errIteratorNotAllowed: "iterators can only be defined at the module\'s top level",
errXNeedsReturnType: "$1 needs a return type", errXNeedsReturnType: "$1 needs a return type",
errNoReturnTypeDeclared: "no return type declared", errNoReturnTypeDeclared: "no return type declared",
errInvalidCommandX: "invalid command: \'$1\'", errInvalidCommandX: "invalid command: \'$1\'",
errXOnlyAtModuleScope: "\'$1\' is only allowed at top level", errXOnlyAtModuleScope: "\'$1\' is only allowed at top level",
errXNeedsParamObjectType: "'$1' needs a parameter that has an object type", errXNeedsParamObjectType: "'$1' needs a parameter that has an object type",
errTemplateInstantiationTooNested: "template/macro instantiation too nested", errTemplateInstantiationTooNested: "template/macro instantiation too nested",
errInstantiationFrom: "template/generic instantiation from here", errInstantiationFrom: "template/generic instantiation from here",
errInvalidIndexValueForTuple: "invalid index value for tuple subscript", errInvalidIndexValueForTuple: "invalid index value for tuple subscript",
errCommandExpectsFilename: "command expects a filename argument", errCommandExpectsFilename: "command expects a filename argument",
errMainModuleMustBeSpecified: "please, specify a main module in the project configuration file", errMainModuleMustBeSpecified: "please, specify a main module in the project configuration file",
errXExpected: "\'$1\' expected", errXExpected: "\'$1\' expected",
errTIsNotAConcreteType: "\'$1\' is not a concrete type.", errTIsNotAConcreteType: "\'$1\' is not a concrete type.",
errInvalidSectionStart: "invalid section start", errInvalidSectionStart: "invalid section start",
errGridTableNotImplemented: "grid table is not implemented", errGridTableNotImplemented: "grid table is not implemented",
errGeneralParseError: "general parse error", errGeneralParseError: "general parse error",
errNewSectionExpected: "new section expected", errNewSectionExpected: "new section expected",
errWhitespaceExpected: "whitespace expected, got \'$1\'", errWhitespaceExpected: "whitespace expected, got \'$1\'",
errXisNoValidIndexFile: "\'$1\' is no valid index file", errXisNoValidIndexFile: "\'$1\' is no valid index file",
errCannotRenderX: "cannot render reStructuredText element \'$1\'", errCannotRenderX: "cannot render reStructuredText element \'$1\'",
errVarVarTypeNotAllowed: "type \'var var\' is not allowed", errVarVarTypeNotAllowed: "type \'var var\' is not allowed",
errInstantiateXExplicitly: "instantiate '$1' explicitly", errInstantiateXExplicitly: "instantiate '$1' explicitly",
errOnlyACallOpCanBeDelegator: "only a call operator can be a delegator", errOnlyACallOpCanBeDelegator: "only a call operator can be a delegator",
@ -335,24 +335,24 @@ const
"A destructor must be associated will all instantiations of a generic type", "A destructor must be associated will all instantiations of a generic type",
errInlineIteratorsAsProcParams: "inline iterators can be used as parameters only for " & errInlineIteratorsAsProcParams: "inline iterators can be used as parameters only for " &
"templates, macros and other inline iterators", "templates, macros and other inline iterators",
errXExpectsTwoArguments: "\'$1\' expects two arguments", errXExpectsTwoArguments: "\'$1\' expects two arguments",
errXExpectsObjectTypes: "\'$1\' expects object types", errXExpectsObjectTypes: "\'$1\' expects object types",
errXcanNeverBeOfThisSubtype: "\'$1\' can never be of this subtype", errXcanNeverBeOfThisSubtype: "\'$1\' can never be of this subtype",
errTooManyIterations: "interpretation requires too many iterations", errTooManyIterations: "interpretation requires too many iterations",
errCannotInterpretNodeX: "cannot evaluate \'$1\'", errCannotInterpretNodeX: "cannot evaluate \'$1\'",
errFieldXNotFound: "field \'$1\' cannot be found", errFieldXNotFound: "field \'$1\' cannot be found",
errInvalidConversionFromTypeX: "invalid conversion from type \'$1\'", errInvalidConversionFromTypeX: "invalid conversion from type \'$1\'",
errAssertionFailed: "assertion failed", errAssertionFailed: "assertion failed",
errCannotGenerateCodeForX: "cannot generate code for \'$1\'", errCannotGenerateCodeForX: "cannot generate code for \'$1\'",
errXRequiresOneArgument: "$1 requires one parameter", errXRequiresOneArgument: "$1 requires one parameter",
errUnhandledExceptionX: "unhandled exception: $1", errUnhandledExceptionX: "unhandled exception: $1",
errCyclicTree: "macro returned a cyclic abstract syntax tree", errCyclicTree: "macro returned a cyclic abstract syntax tree",
errXisNoMacroOrTemplate: "\'$1\' is no macro or template", errXisNoMacroOrTemplate: "\'$1\' is no macro or template",
errXhasSideEffects: "\'$1\' can have side effects", errXhasSideEffects: "\'$1\' can have side effects",
errIteratorExpected: "iterator within for loop context expected", errIteratorExpected: "iterator within for loop context expected",
errLetNeedsInit: "'let' symbol requires an initialization", errLetNeedsInit: "'let' symbol requires an initialization",
errThreadvarCannotInit: "a thread var cannot be initialized explicitly", errThreadvarCannotInit: "a thread var cannot be initialized explicitly",
errWrongSymbolX: "usage of \'$1\' is a user-defined error", errWrongSymbolX: "usage of \'$1\' is a user-defined error",
errIllegalCaptureX: "illegal capture '$1'", errIllegalCaptureX: "illegal capture '$1'",
errXCannotBeClosure: "'$1' cannot have 'closure' calling convention", errXCannotBeClosure: "'$1' cannot have 'closure' calling convention",
errXMustBeCompileTime: "'$1' can only be used in compile-time context", errXMustBeCompileTime: "'$1' can only be used in compile-time context",
@ -362,21 +362,21 @@ const
"it is used as an operand to another routine and the types " & "it is used as an operand to another routine and the types " &
"of the generic paramers can be inferred from the expected signature.", "of the generic paramers can be inferred from the expected signature.",
errCompilerDoesntSupportTarget: "The current compiler \'$1\' doesn't support the requested compilation target", errCompilerDoesntSupportTarget: "The current compiler \'$1\' doesn't support the requested compilation target",
errUser: "$1", errUser: "$1",
warnCannotOpenFile: "cannot open \'$1\' [CannotOpenFile]", warnCannotOpenFile: "cannot open \'$1\' [CannotOpenFile]",
warnOctalEscape: "octal escape sequences do not exist; leading zero is ignored [OctalEscape]", warnOctalEscape: "octal escape sequences do not exist; leading zero is ignored [OctalEscape]",
warnXIsNeverRead: "\'$1\' is never read [XIsNeverRead]", warnXIsNeverRead: "\'$1\' is never read [XIsNeverRead]",
warnXmightNotBeenInit: "\'$1\' might not have been initialized [XmightNotBeenInit]", warnXmightNotBeenInit: "\'$1\' might not have been initialized [XmightNotBeenInit]",
warnDeprecated: "$1 is deprecated [Deprecated]", warnDeprecated: "$1 is deprecated [Deprecated]",
warnConfigDeprecated: "config file '$1' is deprecated [ConfigDeprecated]", warnConfigDeprecated: "config file '$1' is deprecated [ConfigDeprecated]",
warnSmallLshouldNotBeUsed: "\'l\' should not be used as an identifier; may look like \'1\' (one) [SmallLshouldNotBeUsed]", warnSmallLshouldNotBeUsed: "\'l\' should not be used as an identifier; may look like \'1\' (one) [SmallLshouldNotBeUsed]",
warnUnknownMagic: "unknown magic \'$1\' might crash the compiler [UnknownMagic]", warnUnknownMagic: "unknown magic \'$1\' might crash the compiler [UnknownMagic]",
warnRedefinitionOfLabel: "redefinition of label \'$1\' [RedefinitionOfLabel]", warnRedefinitionOfLabel: "redefinition of label \'$1\' [RedefinitionOfLabel]",
warnUnknownSubstitutionX: "unknown substitution \'$1\' [UnknownSubstitutionX]", warnUnknownSubstitutionX: "unknown substitution \'$1\' [UnknownSubstitutionX]",
warnLanguageXNotSupported: "language \'$1\' not supported [LanguageXNotSupported]", warnLanguageXNotSupported: "language \'$1\' not supported [LanguageXNotSupported]",
warnFieldXNotSupported: "field \'$1\' not supported [FieldXNotSupported]", warnFieldXNotSupported: "field \'$1\' not supported [FieldXNotSupported]",
warnCommentXIgnored: "comment \'$1\' ignored [CommentXIgnored]", warnCommentXIgnored: "comment \'$1\' ignored [CommentXIgnored]",
warnNilStatement: "'nil' statement is deprecated; use an empty 'discard' statement instead [NilStmt]", warnNilStatement: "'nil' statement is deprecated; use an empty 'discard' statement instead [NilStmt]",
warnTypelessParam: "'$1' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]", warnTypelessParam: "'$1' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]",
warnDifferentHeaps: "possible inconsistency of thread local heaps [DifferentHeaps]", warnDifferentHeaps: "possible inconsistency of thread local heaps [DifferentHeaps]",
warnWriteToForeignHeap: "write to foreign heap [WriteToForeignHeap]", warnWriteToForeignHeap: "write to foreign heap [WriteToForeignHeap]",
@ -393,19 +393,19 @@ const
warnDestructor: "usage of a type with a destructor in a non destructible context. This will become a compile time error in the future. [Destructor]", warnDestructor: "usage of a type with a destructor in a non destructible context. This will become a compile time error in the future. [Destructor]",
warnLockLevel: "$1 [LockLevel]", warnLockLevel: "$1 [LockLevel]",
warnResultShadowed: "Special variable 'result' is shadowed. [ResultShadowed]", warnResultShadowed: "Special variable 'result' is shadowed. [ResultShadowed]",
warnUser: "$1 [User]", warnUser: "$1 [User]",
hintSuccess: "operation successful [Success]", hintSuccess: "operation successful [Success]",
hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#) [SuccessX]", hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#; $#) [SuccessX]",
hintLineTooLong: "line too long [LineTooLong]", hintLineTooLong: "line too long [LineTooLong]",
hintXDeclaredButNotUsed: "\'$1\' is declared but not used [XDeclaredButNotUsed]", hintXDeclaredButNotUsed: "\'$1\' is declared but not used [XDeclaredButNotUsed]",
hintConvToBaseNotNeeded: "conversion to base object is not needed [ConvToBaseNotNeeded]", hintConvToBaseNotNeeded: "conversion to base object is not needed [ConvToBaseNotNeeded]",
hintConvFromXtoItselfNotNeeded: "conversion from $1 to itself is pointless [ConvFromXtoItselfNotNeeded]", hintConvFromXtoItselfNotNeeded: "conversion from $1 to itself is pointless [ConvFromXtoItselfNotNeeded]",
hintExprAlwaysX: "expression evaluates always to \'$1\' [ExprAlwaysX]", hintExprAlwaysX: "expression evaluates always to \'$1\' [ExprAlwaysX]",
hintQuitCalled: "quit() called [QuitCalled]", hintQuitCalled: "quit() called [QuitCalled]",
hintProcessing: "$1 [Processing]", hintProcessing: "$1 [Processing]",
hintCodeBegin: "generated code listing: [CodeBegin]", hintCodeBegin: "generated code listing: [CodeBegin]",
hintCodeEnd: "end of listing [CodeEnd]", hintCodeEnd: "end of listing [CodeEnd]",
hintConf: "used config file \'$1\' [Conf]", hintConf: "used config file \'$1\' [Conf]",
hintPath: "added path: '$1' [Path]", hintPath: "added path: '$1' [Path]",
hintConditionAlwaysTrue: "condition is always true: '$1' [CondTrue]", hintConditionAlwaysTrue: "condition is always true: '$1' [CondTrue]",
hintName: "name should be: '$1' [Name]", hintName: "name should be: '$1' [Name]",
@ -413,25 +413,25 @@ const
hintUser: "$1 [User]"] hintUser: "$1 [User]"]
const const
WarningsToStr*: array[0..30, string] = ["CannotOpenFile", "OctalEscape", WarningsToStr*: array[0..30, string] = ["CannotOpenFile", "OctalEscape",
"XIsNeverRead", "XmightNotBeenInit", "XIsNeverRead", "XmightNotBeenInit",
"Deprecated", "ConfigDeprecated", "Deprecated", "ConfigDeprecated",
"SmallLshouldNotBeUsed", "UnknownMagic", "SmallLshouldNotBeUsed", "UnknownMagic",
"RedefinitionOfLabel", "UnknownSubstitutionX", "RedefinitionOfLabel", "UnknownSubstitutionX",
"LanguageXNotSupported", "FieldXNotSupported", "LanguageXNotSupported", "FieldXNotSupported",
"CommentXIgnored", "NilStmt", "CommentXIgnored", "NilStmt",
"TypelessParam", "DifferentHeaps", "WriteToForeignHeap", "TypelessParam", "DifferentHeaps", "WriteToForeignHeap",
"UnsafeCode", "EachIdentIsTuple", "ShadowIdent", "UnsafeCode", "EachIdentIsTuple", "ShadowIdent",
"ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit", "ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
"GcMem", "Destructor", "LockLevel", "ResultShadowed", "User"] "GcMem", "Destructor", "LockLevel", "ResultShadowed", "User"]
HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong", HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong",
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded", "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
"ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf", "ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
"Path", "CondTrue", "Name", "Pattern", "Path", "CondTrue", "Name", "Pattern",
"User"] "User"]
const const
fatalMin* = errUnknown fatalMin* = errUnknown
fatalMax* = errInternal fatalMax* = errInternal
errMin* = errUnknown errMin* = errUnknown
@ -440,18 +440,18 @@ const
warnMax* = pred(hintSuccess) warnMax* = pred(hintSuccess)
hintMin* = hintSuccess hintMin* = hintSuccess
hintMax* = high(TMsgKind) hintMax* = high(TMsgKind)
type type
TNoteKind* = range[warnMin..hintMax] # "notes" are warnings or hints TNoteKind* = range[warnMin..hintMax] # "notes" are warnings or hints
TNoteKinds* = set[TNoteKind] TNoteKinds* = set[TNoteKind]
TFileInfo* = object TFileInfo* = object
fullPath: string # This is a canonical full filesystem path fullPath: string # This is a canonical full filesystem path
projPath*: string # This is relative to the project's root projPath*: string # This is relative to the project's root
shortName*: string # short name of the module shortName*: string # short name of the module
quotedName*: PRope # cached quoted short name for codegen quotedName*: PRope # cached quoted short name for codegen
# purposes # purposes
lines*: seq[PRope] # the source code of the module lines*: seq[PRope] # the source code of the module
# used for better error messages and # used for better error messages and
# embedding the original source in the # embedding the original source in the
@ -462,13 +462,13 @@ type
TLineInfo* = object # This is designed to be as small as possible, TLineInfo* = object # This is designed to be as small as possible,
# because it is used # because it is used
# in syntax nodes. We save space here by using # in syntax nodes. We save space here by using
# two int16 and an int32. # two int16 and an int32.
# On 64 bit and on 32 bit systems this is # On 64 bit and on 32 bit systems this is
# only 8 bytes. # only 8 bytes.
line*, col*: int16 line*, col*: int16
fileIndex*: int32 fileIndex*: int32
TErrorOutput* = enum TErrorOutput* = enum
eStdOut eStdOut
eStdErr eStdErr
@ -487,7 +487,7 @@ var
fileInfos*: seq[TFileInfo] = @[] fileInfos*: seq[TFileInfo] = @[]
systemFileIdx*: int32 systemFileIdx*: int32
proc toCChar*(c: char): string = proc toCChar*(c: char): string =
case c case c
of '\0'..'\x1F', '\x80'..'\xFF': result = '\\' & toOctal(c) of '\0'..'\x1F', '\x80'..'\xFF': result = '\\' & toOctal(c)
of '\'', '\"', '\\': result = '\\' & c of '\'', '\"', '\\': result = '\\' & c
@ -497,7 +497,7 @@ proc makeCString*(s: string): PRope =
# BUGFIX: We have to split long strings into many ropes. Otherwise # BUGFIX: We have to split long strings into many ropes. Otherwise
# this could trigger an internalError(). See the ropes module for # this could trigger an internalError(). See the ropes module for
# further information. # further information.
const const
MaxLineLength = 64 MaxLineLength = 64
result = nil result = nil
var res = "\"" var res = "\""
@ -571,7 +571,7 @@ proc raiseRecoverableError*(msg: string) {.noinline, noreturn.} =
proc sourceLine*(i: TLineInfo): PRope proc sourceLine*(i: TLineInfo): PRope
var var
gNotes*: TNoteKinds = {low(TNoteKind)..high(TNoteKind)} - gNotes*: TNoteKinds = {low(TNoteKind)..high(TNoteKind)} -
{warnShadowIdent, warnUninit, {warnShadowIdent, warnUninit,
warnProveField, warnProveIndex, warnGcUnsafe} warnProveField, warnProveIndex, warnGcUnsafe}
gErrorCounter*: int = 0 # counts the number of errors gErrorCounter*: int = 0 # counts the number of errors
@ -584,7 +584,7 @@ proc unknownLineInfo*(): TLineInfo =
result.col = int16(-1) result.col = int16(-1)
result.fileIndex = -1 result.fileIndex = -1
var var
msgContext: seq[TLineInfo] = @[] msgContext: seq[TLineInfo] = @[]
lastError = unknownLineInfo() lastError = unknownLineInfo()
bufferedMsgs*: seq[string] bufferedMsgs*: seq[string]
@ -599,7 +599,7 @@ proc suggestWriteln*(s: string) =
if eStdOut in errorOutputs: if eStdOut in errorOutputs:
if isNil(writelnHook): writeln(stdout, s) if isNil(writelnHook): writeln(stdout, s)
else: writelnHook(s) else: writelnHook(s)
if eInMemory in errorOutputs: if eInMemory in errorOutputs:
bufferedMsgs.safeAdd(s) bufferedMsgs.safeAdd(s)
@ -623,10 +623,10 @@ const
proc getInfoContextLen*(): int = return msgContext.len proc getInfoContextLen*(): int = return msgContext.len
proc setInfoContextLen*(L: int) = setLen(msgContext, L) proc setInfoContextLen*(L: int) = setLen(msgContext, L)
proc pushInfoContext*(info: TLineInfo) = proc pushInfoContext*(info: TLineInfo) =
msgContext.add(info) msgContext.add(info)
proc popInfoContext*() = proc popInfoContext*() =
setLen(msgContext, len(msgContext) - 1) setLen(msgContext, len(msgContext) - 1)
proc getInfoContext*(index: int): TLineInfo = proc getInfoContext*(index: int): TLineInfo =
@ -669,10 +669,10 @@ proc toMsgFilename*(info: TLineInfo): string =
else: else:
result = fileInfos[info.fileIndex].projPath result = fileInfos[info.fileIndex].projPath
proc toLinenumber*(info: TLineInfo): int {.inline.} = proc toLinenumber*(info: TLineInfo): int {.inline.} =
result = info.line result = info.line
proc toColumn*(info: TLineInfo): int {.inline.} = proc toColumn*(info: TLineInfo): int {.inline.} =
result = info.col result = info.col
proc toFileLine*(info: TLineInfo): string {.inline.} = proc toFileLine*(info: TLineInfo): string {.inline.} =
@ -689,11 +689,11 @@ proc `??`* (info: TLineInfo, filename: string): bool =
var gTrackPos*: TLineInfo var gTrackPos*: TLineInfo
proc outWriteln*(s: string) = proc outWriteln*(s: string) =
## Writes to stdout. Always. ## Writes to stdout. Always.
if eStdOut in errorOutputs: writeln(stdout, s) if eStdOut in errorOutputs: writeln(stdout, s)
proc msgWriteln*(s: string) = proc msgWriteln*(s: string) =
## Writes to stdout. If --stdout option is given, writes to stderr instead. ## Writes to stdout. If --stdout option is given, writes to stderr instead.
#if gCmd == cmdIdeTools and optCDebug notin gGlobalOptions: return #if gCmd == cmdIdeTools and optCDebug notin gGlobalOptions: return
@ -704,18 +704,18 @@ proc msgWriteln*(s: string) =
if eStdErr in errorOutputs: writeln(stderr, s) if eStdErr in errorOutputs: writeln(stderr, s)
else: else:
if eStdOut in errorOutputs: writeln(stdout, s) if eStdOut in errorOutputs: writeln(stdout, s)
if eInMemory in errorOutputs: bufferedMsgs.safeAdd(s) if eInMemory in errorOutputs: bufferedMsgs.safeAdd(s)
proc coordToStr(coord: int): string = proc coordToStr(coord: int): string =
if coord == -1: result = "???" if coord == -1: result = "???"
else: result = $coord else: result = $coord
proc msgKindToString*(kind: TMsgKind): string = proc msgKindToString*(kind: TMsgKind): string =
# later versions may provide translated error messages # later versions may provide translated error messages
result = MsgKindToStr[kind] result = MsgKindToStr[kind]
proc getMessageStr(msg: TMsgKind, arg: string): string = proc getMessageStr(msg: TMsgKind, arg: string): string =
result = msgKindToString(msg) % [arg] result = msgKindToString(msg) % [arg]
type type
@ -745,34 +745,34 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) =
proc `==`*(a, b: TLineInfo): bool = proc `==`*(a, b: TLineInfo): bool =
result = a.line == b.line and a.fileIndex == b.fileIndex result = a.line == b.line and a.fileIndex == b.fileIndex
proc writeContext(lastinfo: TLineInfo) = proc writeContext(lastinfo: TLineInfo) =
var info = lastinfo var info = lastinfo
for i in countup(0, len(msgContext) - 1): for i in countup(0, len(msgContext) - 1):
if msgContext[i] != lastinfo and msgContext[i] != info: if msgContext[i] != lastinfo and msgContext[i] != info:
msgWriteln(PosContextFormat % [toMsgFilename(msgContext[i]), msgWriteln(PosContextFormat % [toMsgFilename(msgContext[i]),
coordToStr(msgContext[i].line), coordToStr(msgContext[i].line),
coordToStr(msgContext[i].col), coordToStr(msgContext[i].col),
getMessageStr(errInstantiationFrom, "")]) getMessageStr(errInstantiationFrom, "")])
info = msgContext[i] info = msgContext[i]
proc ignoreMsgBecauseOfIdeTools(msg: TMsgKind): bool = proc ignoreMsgBecauseOfIdeTools(msg: TMsgKind): bool =
msg >= errGenerated and gCmd == cmdIdeTools and optIdeDebug notin gGlobalOptions msg >= errGenerated and gCmd == cmdIdeTools and optIdeDebug notin gGlobalOptions
proc rawMessage*(msg: TMsgKind, args: openArray[string]) = proc rawMessage*(msg: TMsgKind, args: openArray[string]) =
var frmt: string var frmt: string
case msg case msg
of errMin..errMax: of errMin..errMax:
writeContext(unknownLineInfo()) writeContext(unknownLineInfo())
frmt = RawErrorFormat frmt = RawErrorFormat
of warnMin..warnMax: of warnMin..warnMax:
if optWarns notin gOptions: return if optWarns notin gOptions: return
if msg notin gNotes: return if msg notin gNotes: return
writeContext(unknownLineInfo()) writeContext(unknownLineInfo())
frmt = RawWarningFormat frmt = RawWarningFormat
inc(gWarnCounter) inc(gWarnCounter)
of hintMin..hintMax: of hintMin..hintMax:
if optHints notin gOptions: return if optHints notin gOptions: return
if msg notin gNotes: return if msg notin gNotes: return
frmt = RawHintFormat frmt = RawHintFormat
inc(gHintCounter) inc(gHintCounter)
let s = `%`(frmt, `%`(msgKindToString(msg), args)) let s = `%`(frmt, `%`(msgKindToString(msg), args))
@ -780,7 +780,7 @@ proc rawMessage*(msg: TMsgKind, args: openArray[string]) =
msgWriteln(s) msgWriteln(s)
handleError(msg, doAbort, s) handleError(msg, doAbort, s)
proc rawMessage*(msg: TMsgKind, arg: string) = proc rawMessage*(msg: TMsgKind, arg: string) =
rawMessage(msg, [arg]) rawMessage(msg, [arg])
proc writeSurroundingSrc(info: TLineInfo) = proc writeSurroundingSrc(info: TLineInfo) =
@ -796,7 +796,7 @@ proc formatMsg*(info: TLineInfo, msg: TMsgKind, arg: string): string =
result = frmt % [toMsgFilename(info), coordToStr(info.line), result = frmt % [toMsgFilename(info), coordToStr(info.line),
coordToStr(info.col), getMessageStr(msg, arg)] coordToStr(info.col), getMessageStr(msg, arg)]
proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
eh: TErrorHandling) = eh: TErrorHandling) =
var frmt: string var frmt: string
var ignoreMsg = false var ignoreMsg = false
@ -813,7 +813,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
if not ignoreMsg: writeContext(info) if not ignoreMsg: writeContext(info)
frmt = PosWarningFormat frmt = PosWarningFormat
inc(gWarnCounter) inc(gWarnCounter)
of hintMin..hintMax: of hintMin..hintMax:
ignoreMsg = optHints notin gOptions or msg notin gNotes ignoreMsg = optHints notin gOptions or msg notin gNotes
frmt = PosHintFormat frmt = PosHintFormat
inc(gHintCounter) inc(gHintCounter)
@ -824,11 +824,11 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
if optPrintSurroundingSrc and msg in errMin..errMax: if optPrintSurroundingSrc and msg in errMin..errMax:
info.writeSurroundingSrc info.writeSurroundingSrc
handleError(msg, eh, s) handleError(msg, eh, s)
proc fatal*(info: TLineInfo, msg: TMsgKind, arg = "") = proc fatal*(info: TLineInfo, msg: TMsgKind, arg = "") =
liMessage(info, msg, arg, doAbort) liMessage(info, msg, arg, doAbort)
proc globalError*(info: TLineInfo, msg: TMsgKind, arg = "") = proc globalError*(info: TLineInfo, msg: TMsgKind, arg = "") =
liMessage(info, msg, arg, doRaise) liMessage(info, msg, arg, doRaise)
proc globalError*(info: TLineInfo, arg: string) = proc globalError*(info: TLineInfo, arg: string) =
@ -843,12 +843,12 @@ proc localError*(info: TLineInfo, arg: string) =
proc message*(info: TLineInfo, msg: TMsgKind, arg = "") = proc message*(info: TLineInfo, msg: TMsgKind, arg = "") =
liMessage(info, msg, arg, doNothing) liMessage(info, msg, arg, doNothing)
proc internalError*(info: TLineInfo, errMsg: string) = proc internalError*(info: TLineInfo, errMsg: string) =
if gCmd == cmdIdeTools: return if gCmd == cmdIdeTools: return
writeContext(info) writeContext(info)
liMessage(info, errInternal, errMsg, doAbort) liMessage(info, errInternal, errMsg, doAbort)
proc internalError*(errMsg: string) = proc internalError*(errMsg: string) =
if gCmd == cmdIdeTools: return if gCmd == cmdIdeTools: return
writeContext(unknownLineInfo()) writeContext(unknownLineInfo())
rawMessage(errInternal, errMsg) rawMessage(errInternal, errMsg)
@ -865,7 +865,7 @@ proc addSourceLine*(fileIdx: int32, line: string) =
proc sourceLine*(i: TLineInfo): PRope = proc sourceLine*(i: TLineInfo): PRope =
if i.fileIndex < 0: return nil if i.fileIndex < 0: return nil
if not optPreserveOrigSource and fileInfos[i.fileIndex].lines.len == 0: if not optPreserveOrigSource and fileInfos[i.fileIndex].lines.len == 0:
try: try:
for line in lines(i.toFullPath): for line in lines(i.toFullPath):

View file

@ -29,6 +29,7 @@ Options:
--infChecks:on|off turn Inf checks on|off --infChecks:on|off turn Inf checks on|off
--deadCodeElim:on|off whole program dead code elimination on|off --deadCodeElim:on|off whole program dead code elimination on|off
--opt:none|speed|size optimize not at all or for speed|size --opt:none|speed|size optimize not at all or for speed|size
Note: use -d:release for a release build!
--debugger:native|endb use native debugger (gdb) | ENDB (experimental) --debugger:native|endb use native debugger (gdb) | ENDB (experimental)
--app:console|gui|lib|staticlib --app:console|gui|lib|staticlib
generate a console app|GUI app|DLL|static library generate a console app|GUI app|DLL|static library