Fix typos

This commit is contained in:
Federico Ceratto 2015-02-15 16:06:06 +00:00
commit c95f6f117a
49 changed files with 115 additions and 115 deletions

View file

@ -314,7 +314,7 @@ type
# XXX put this into an include file to avoid this issue! # XXX put this into an include file to avoid this issue!
tyNone, tyBool, tyChar, tyNone, tyBool, tyChar,
tyEmpty, tyArrayConstr, tyNil, tyExpr, tyStmt, tyTypeDesc, tyEmpty, tyArrayConstr, tyNil, tyExpr, tyStmt, tyTypeDesc,
tyGenericInvokation, # ``T[a, b]`` for types to invoke tyGenericInvocation, # ``T[a, b]`` for types to invoke
tyGenericBody, # ``T[a, b, body]`` last parameter is the body tyGenericBody, # ``T[a, b, body]`` last parameter is the body
tyGenericInst, # ``T[a, b, realInstance]`` instantiated generic type tyGenericInst, # ``T[a, b, realInstance]`` instantiated generic type
# realInstance will be a concrete type like tyObject # realInstance will be a concrete type like tyObject
@ -859,7 +859,7 @@ const
OverloadableSyms* = {skProc, skMethod, skIterator, skClosureIterator, OverloadableSyms* = {skProc, skMethod, skIterator, skClosureIterator,
skConverter, skModule, skTemplate, skMacro} skConverter, skModule, skTemplate, skMacro}
GenericTypes*: TTypeKinds = {tyGenericInvokation, tyGenericBody, GenericTypes*: TTypeKinds = {tyGenericInvocation, tyGenericBody,
tyGenericParam} tyGenericParam}
StructuralEquivTypes*: TTypeKinds = {tyArrayConstr, tyNil, tyTuple, tyArray, StructuralEquivTypes*: TTypeKinds = {tyArrayConstr, tyNil, tyTuple, tyArray,
@ -1350,7 +1350,7 @@ proc propagateToOwner*(owner, elem: PType) =
const HaveTheirOwnEmpty = {tySequence, tySet} const HaveTheirOwnEmpty = {tySequence, tySet}
owner.flags = owner.flags + (elem.flags * {tfHasMeta}) owner.flags = owner.flags + (elem.flags * {tfHasMeta})
if tfNotNil in elem.flags: if tfNotNil in elem.flags:
if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvokation}: if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvocation}:
owner.flags.incl tfNotNil owner.flags.incl tfNotNil
elif owner.kind notin HaveTheirOwnEmpty: elif owner.kind notin HaveTheirOwnEmpty:
owner.flags.incl tfNeedsInit owner.flags.incl tfNeedsInit

View file

@ -119,8 +119,8 @@ proc hashType(c: var MD5Context, t: PType) =
c.hashSym(t.sym) c.hashSym(t.sym)
case t.kind case t.kind
of tyGenericBody, tyGenericInst, tyGenericInvokation: of tyGenericBody, tyGenericInst, tyGenericInvocation:
for i in countup(0, sonsLen(t) -1 -ord(t.kind != tyGenericInvokation)): for i in countup(0, sonsLen(t) -1 -ord(t.kind != tyGenericInvocation)):
c.hashType t.sons[i] c.hashType t.sons[i]
of tyUserTypeClass: of tyUserTypeClass:
internalAssert t.sym != nil and t.sym.owner != nil internalAssert t.sym != nil and t.sym.owner != nil

View file

@ -1390,7 +1390,7 @@ proc genSwap(p: BProc, e: PNode, d: var TLoc) =
genAssignment(p, b, tmp, {}) genAssignment(p, b, tmp, {})
proc rdSetElemLoc(a: TLoc, setType: PType): PRope = proc rdSetElemLoc(a: TLoc, setType: PType): PRope =
# read a location of an set element; it may need a substraction operation # read a location of an set element; it may need a subtraction operation
# before the set operation # before the set operation
result = rdCharLoc(a) result = rdCharLoc(a)
assert(setType.kind == tySet) assert(setType.kind == tySet)

View file

@ -223,7 +223,7 @@ proc processMergeInfo(L: var TBaseLexer, m: BModule) =
of "typeInfo": readIntSet(L, m.typeInfoMarker) of "typeInfo": readIntSet(L, m.typeInfoMarker)
of "labels": m.labels = decodeVInt(L.buf, L.bufpos) of "labels": m.labels = decodeVInt(L.buf, L.bufpos)
of "hasframe": m.frameDeclared = decodeVInt(L.buf, L.bufpos) != 0 of "hasframe": m.frameDeclared = decodeVInt(L.buf, L.bufpos) != 0
else: internalError("ccgmerge: unkown key: " & k) else: internalError("ccgmerge: unknown key: " & k)
when not defined(nimhygiene): when not defined(nimhygiene):
{.pragma: inject.} {.pragma: inject.}

View file

@ -96,7 +96,7 @@ proc getUniqueType*(key: PType): PType =
#if obj.sym != nil and obj.sym.name.s == "TOption": #if obj.sym != nil and obj.sym.name.s == "TOption":
# echo "for ", typeToString(key), " I returned " # echo "for ", typeToString(key), " I returned "
# debug result # debug result
of tyArrayConstr, tyGenericInvokation, tyGenericBody, of tyArrayConstr, tyGenericInvocation, tyGenericBody,
tyOpenArray, tyArray, tySet, tyRange, tyTuple, tyOpenArray, tyArray, tySet, tyRange, tyTuple,
tyPtr, tyRef, tySequence, tyForward, tyVarargs, tyProxy, tyVar: tyPtr, tyRef, tySequence, tyForward, tyVarargs, tyProxy, tyVar:
# tuples are quite horrible as C does not support them directly and # tuples are quite horrible as C does not support them directly and

View file

@ -126,7 +126,7 @@ proc ropeFormatNamedVars(frmt: TFormatStr, varnames: openArray[string],
if not (frmt[i] in {'A'..'Z', '_', 'a'..'z', '\x80'..'\xFF'}): break if not (frmt[i] in {'A'..'Z', '_', 'a'..'z', '\x80'..'\xFF'}): break
var idx = getVarIdx(varnames, id) var idx = getVarIdx(varnames, id)
if idx >= 0: app(result, varvalues[idx]) if idx >= 0: app(result, varvalues[idx])
else: rawMessage(errUnkownSubstitionVar, id) else: rawMessage(errUnknownSubstitionVar, id)
of '{': of '{':
var id = "" var id = ""
inc(i) inc(i)
@ -138,7 +138,7 @@ proc ropeFormatNamedVars(frmt: TFormatStr, varnames: openArray[string],
# search for the variable: # search for the variable:
var idx = getVarIdx(varnames, id) var idx = getVarIdx(varnames, id)
if idx >= 0: app(result, varvalues[idx]) if idx >= 0: app(result, varvalues[idx])
else: rawMessage(errUnkownSubstitionVar, id) else: rawMessage(errUnknownSubstitionVar, id)
else: internalError("ropeFormatNamedVars") else: internalError("ropeFormatNamedVars")
var start = i var start = i
while i < L: while i < L:

View file

@ -148,7 +148,7 @@ proc mapType(typ: PType): TJSTypeKind =
tyVarargs: tyVarargs:
result = etyObject result = etyObject
of tyNil: result = etyNull of tyNil: result = etyNull
of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvokation, of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvocation,
tyNone, tyFromExpr, tyForward, tyEmpty, tyFieldAccessor, tyNone, tyFromExpr, tyForward, tyEmpty, tyFieldAccessor,
tyExpr, tyStmt, tyStatic, tyTypeDesc, tyTypeClasses: tyExpr, tyStmt, tyStatic, tyTypeDesc, tyTypeClasses:
result = etyNone result = etyNone

View file

@ -15,7 +15,7 @@ import
discard """ discard """
The basic approach is that captured vars need to be put on the heap and The basic approach is that captured vars need to be put on the heap and
that the calling chain needs to be explicitely modelled. Things to consider: that the calling chain needs to be explicitly modelled. Things to consider:
proc a = proc a =
var v = 0 var v = 0
@ -583,7 +583,7 @@ proc searchForInnerProcs(o: POuterContext, n: PNode, env: PEnv) =
elif it.kind == nkIdentDefs: elif it.kind == nkIdentDefs:
var L = sonsLen(it) var L = sonsLen(it)
if it.sons[0].kind == nkSym: if it.sons[0].kind == nkSym:
# this can be false for recursive invokations that already # this can be false for recursive invocations that already
# transformed it into 'env.varName': # transformed it into 'env.varName':
env.vars.incl(it.sons[0].sym.id) env.vars.incl(it.sons[0].sym.id)
searchForInnerProcs(o, it.sons[L-1], env) searchForInnerProcs(o, it.sons[L-1], env)

View file

@ -69,7 +69,7 @@ type
errInvalidOrderInArrayConstructor, errInvalidOrderInArrayConstructor,
errInvalidOrderInEnumX, errEnumXHasHoles, errExceptExpected, errInvalidTry, errInvalidOrderInEnumX, errEnumXHasHoles, errExceptExpected, errInvalidTry,
errOptionExpected, errXisNoLabel, errNotAllCasesCovered, errOptionExpected, errXisNoLabel, errNotAllCasesCovered,
errUnkownSubstitionVar, errComplexStmtRequiresInd, errXisNotCallable, errUnknownSubstitionVar, errComplexStmtRequiresInd, errXisNotCallable,
errNoPragmasAllowedForX, errNoGenericParamsAllowedForX, errNoPragmasAllowedForX, errNoGenericParamsAllowedForX,
errInvalidParamKindX, errDefaultArgumentInvalid, errNamedParamHasToBeIdent, errInvalidParamKindX, errDefaultArgumentInvalid, errNamedParamHasToBeIdent,
errNoReturnTypeForX, errConvNeedsOneArg, errInvalidPragmaX, errNoReturnTypeForX, errConvNeedsOneArg, errInvalidPragmaX,
@ -89,7 +89,7 @@ type
errTIsNotAConcreteType, errTIsNotAConcreteType,
errInvalidSectionStart, errGridTableNotImplemented, errGeneralParseError, errInvalidSectionStart, errGridTableNotImplemented, errGeneralParseError,
errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile, errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile,
errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitely, errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitly,
errOnlyACallOpCanBeDelegator, errUsingNoSymbol, errOnlyACallOpCanBeDelegator, errUsingNoSymbol,
errMacroBodyDependsOnGenericTypes, errMacroBodyDependsOnGenericTypes,
errDestructorNotGenericEnough, errDestructorNotGenericEnough,
@ -279,7 +279,7 @@ const
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",
errUnkownSubstitionVar: "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",
@ -325,7 +325,7 @@ const
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",
errInstantiateXExplicitely: "instantiate '$1' explicitely", errInstantiateXExplicitly: "instantiate '$1' explicitly",
errOnlyACallOpCanBeDelegator: "only a call operator can be a delegator", errOnlyACallOpCanBeDelegator: "only a call operator can be a delegator",
errUsingNoSymbol: "'$1' is not a variable, constant or a proc name", errUsingNoSymbol: "'$1' is not a variable, constant or a proc name",
errMacroBodyDependsOnGenericTypes: "the macro body cannot be compiled, " & errMacroBodyDependsOnGenericTypes: "the macro body cannot be compiled, " &

View file

@ -666,7 +666,7 @@ proc newRodReader(modfilename: string, crc: TCrc32,
r.readerIndex = readerIndex r.readerIndex = readerIndex
r.filename = modfilename r.filename = modfilename
initIdTable(r.syms) initIdTable(r.syms)
# we terminate the file explicitely with ``\0``, so the cast to `cstring` # we terminate the file explicitly with ``\0``, so the cast to `cstring`
# is safe: # is safe:
r.s = cast[cstring](r.memfile.mem) r.s = cast[cstring](r.memfile.mem)
if startsWith(r.s, "NIM:"): if startsWith(r.s, "NIM:"):

View file

@ -184,7 +184,7 @@ proc liftBodyAux(c: TLiftCtx; t: PType; x, y: PNode) =
of tyFromExpr, tyIter, tyProxy, tyBuiltInTypeClass, tyUserTypeClass, of tyFromExpr, tyIter, tyProxy, tyBuiltInTypeClass, tyUserTypeClass,
tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything, tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything,
tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt, tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt,
tyTypeDesc, tyGenericInvokation, tyBigNum, tyConst, tyForward: tyTypeDesc, tyGenericInvocation, tyBigNum, tyConst, tyForward:
internalError(c.info, "assignment requested for type: " & typeToString(t)) internalError(c.info, "assignment requested for type: " & typeToString(t))
of tyDistinct, tyOrdinal, tyRange, of tyDistinct, tyOrdinal, tyRange,
tyGenericInst, tyFieldAccessor, tyStatic, tyVar: tyGenericInst, tyFieldAccessor, tyStatic, tyVar:

View file

@ -30,7 +30,7 @@ proc instantiateDestructor(c: PContext, typ: PType): PType
proc doDestructorStuff(c: PContext, s: PSym, n: PNode) = proc doDestructorStuff(c: PContext, s: PSym, n: PNode) =
var t = s.typ.sons[1].skipTypes({tyVar}) var t = s.typ.sons[1].skipTypes({tyVar})
if t.kind == tyGenericInvokation: if t.kind == tyGenericInvocation:
for i in 1 .. <t.sonsLen: for i in 1 .. <t.sonsLen:
if t.sons[i].kind != tyGenericParam: if t.sons[i].kind != tyGenericParam:
localError(n.info, errDestructorNotGenericEnough) localError(n.info, errDestructorNotGenericEnough)

View file

@ -1637,7 +1637,7 @@ proc semShallowCopy(c: PContext, n: PNode, flags: TExprFlags): PNode =
result = semDirectOp(c, n, flags) result = semDirectOp(c, n, flags)
proc createFlowVar(c: PContext; t: PType; info: TLineInfo): PType = proc createFlowVar(c: PContext; t: PType; info: TLineInfo): PType =
result = newType(tyGenericInvokation, c.module) result = newType(tyGenericInvocation, c.module)
addSonSkipIntLit(result, magicsys.getCompilerProc("FlowVar").typ) addSonSkipIntLit(result, magicsys.getCompilerProc("FlowVar").typ)
addSonSkipIntLit(result, t) addSonSkipIntLit(result, t)
result = instGenericContainer(c, info, result, allowMetaTypes = false) result = instGenericContainer(c, info, result, allowMetaTypes = false)
@ -2001,7 +2001,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
if result.kind == nkSym: if result.kind == nkSym:
markIndirect(c, result.sym) markIndirect(c, result.sym)
# if isGenericRoutine(result.sym): # if isGenericRoutine(result.sym):
# localError(n.info, errInstantiateXExplicitely, s.name.s) # localError(n.info, errInstantiateXExplicitly, s.name.s)
of nkSym: of nkSym:
# because of the changed symbol binding, this does not mean that we # because of the changed symbol binding, this does not mean that we
# don't have to check the symbol for semantics here again! # don't have to check the symbol for semantics here again!

View file

@ -36,7 +36,7 @@ proc instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable,
elif t.kind == tyGenericParam: elif t.kind == tyGenericParam:
localError(a.info, errCannotInstantiateX, q.name.s) localError(a.info, errCannotInstantiateX, q.name.s)
t = errorType(c) t = errorType(c)
elif t.kind == tyGenericInvokation: elif t.kind == tyGenericInvocation:
#t = instGenericContainer(c, a, t) #t = instGenericContainer(c, a, t)
t = generateTypeInstance(c, pt, a, t) t = generateTypeInstance(c, pt, a, t)
#t = ReplaceTypeVarsT(cl, t) #t = ReplaceTypeVarsT(cl, t)

View file

@ -23,7 +23,7 @@ import
# Predefined effects: # Predefined effects:
# io, time (time dependent), gc (performs GC'ed allocation), exceptions, # io, time (time dependent), gc (performs GC'ed allocation), exceptions,
# side effect (accesses global), store (stores into *type*), # side effect (accesses global), store (stores into *type*),
# store_unkown (performs some store) --> store(any)|store(x) # store_unknown (performs some store) --> store(any)|store(x)
# load (loads from *type*), recursive (recursive call), unsafe, # load (loads from *type*), recursive (recursive call), unsafe,
# endless (has endless loops), --> user effects are defined over *patterns* # endless (has endless loops), --> user effects are defined over *patterns*
# --> a TR macro can annotate the proc with user defined annotations # --> a TR macro can annotate the proc with user defined annotations

View file

@ -667,8 +667,8 @@ proc checkForMetaFields(n: PNode) =
let t = n.sym.typ let t = n.sym.typ
case t.kind case t.kind
of tySequence, tySet, tyArray, tyOpenArray, tyVar, tyPtr, tyRef, of tySequence, tySet, tyArray, tyOpenArray, tyVar, tyPtr, tyRef,
tyProc, tyGenericInvokation, tyGenericInst: tyProc, tyGenericInvocation, tyGenericInst:
let start = ord(t.kind in {tyGenericInvokation, tyGenericInst}) let start = ord(t.kind in {tyGenericInvocation, tyGenericInst})
for i in start .. <t.sons.len: for i in start .. <t.sons.len:
checkMeta(t.sons[i]) checkMeta(t.sons[i])
else: else:
@ -912,7 +912,7 @@ proc semOverride(c: PContext, s: PSym, n: PNode) =
var t = s.typ.sons[1].skipTypes(abstractInst).lastSon.skipTypes(abstractInst) var t = s.typ.sons[1].skipTypes(abstractInst).lastSon.skipTypes(abstractInst)
while true: while true:
if t.kind == tyGenericBody: t = t.lastSon if t.kind == tyGenericBody: t = t.lastSon
elif t.kind == tyGenericInvokation: t = t.sons[0] elif t.kind == tyGenericInvocation: t = t.sons[0]
else: break else: break
if t.kind in {tyObject, tyDistinct, tyEnum}: if t.kind in {tyObject, tyDistinct, tyEnum}:
if t.deepCopy.isNil: t.deepCopy = s if t.deepCopy.isNil: t.deepCopy = s

View file

@ -436,7 +436,7 @@ proc semTemplBodyDirty(c: var TemplCtx, n: PNode): PNode =
of nkEmpty, nkSym..nkNilLit: of nkEmpty, nkSym..nkNilLit:
discard discard
else: else:
# dotExpr is ambiguous: note that we explicitely allow 'x.TemplateParam', # dotExpr is ambiguous: note that we explicitly allow 'x.TemplateParam',
# so we use the generic code for nkDotExpr too # so we use the generic code for nkDotExpr too
if n.kind == nkDotExpr or n.kind == nkAccQuoted: if n.kind == nkDotExpr or n.kind == nkAccQuoted:
let s = qualifiedLookUp(c.c, n, {}) let s = qualifiedLookUp(c.c, n, {})
@ -640,7 +640,7 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode =
for i in countup(0, sonsLen(n) - 1): for i in countup(0, sonsLen(n) - 1):
result.sons[i] = semPatternBody(c, n.sons[i]) result.sons[i] = semPatternBody(c, n.sons[i])
else: else:
# dotExpr is ambiguous: note that we explicitely allow 'x.TemplateParam', # dotExpr is ambiguous: note that we explicitly allow 'x.TemplateParam',
# so we use the generic code for nkDotExpr too # so we use the generic code for nkDotExpr too
case n.kind case n.kind
of nkDotExpr, nkAccQuoted: of nkDotExpr, nkAccQuoted:

View file

@ -609,9 +609,9 @@ proc addInheritedFieldsAux(c: PContext, check: var IntSet, pos: var int,
inc(pos) inc(pos)
else: internalError(n.info, "addInheritedFieldsAux()") else: internalError(n.info, "addInheritedFieldsAux()")
proc skipGenericInvokation(t: PType): PType {.inline.} = proc skipGenericInvocation(t: PType): PType {.inline.} =
result = t result = t
if result.kind == tyGenericInvokation: if result.kind == tyGenericInvocation:
result = result.sons[0] result = result.sons[0]
if result.kind == tyGenericBody: if result.kind == tyGenericBody:
result = lastSon(result) result = lastSon(result)
@ -620,7 +620,7 @@ proc addInheritedFields(c: PContext, check: var IntSet, pos: var int,
obj: PType) = obj: PType) =
assert obj.kind == tyObject assert obj.kind == tyObject
if (sonsLen(obj) > 0) and (obj.sons[0] != nil): if (sonsLen(obj) > 0) and (obj.sons[0] != nil):
addInheritedFields(c, check, pos, obj.sons[0].skipGenericInvokation) addInheritedFields(c, check, pos, obj.sons[0].skipGenericInvocation)
addInheritedFieldsAux(c, check, pos, obj.n) addInheritedFieldsAux(c, check, pos, obj.n)
proc semObjectNode(c: PContext, n: PNode, prev: PType): PType = proc semObjectNode(c: PContext, n: PNode, prev: PType): PType =
@ -632,7 +632,7 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType): PType =
checkSonsLen(n, 3) checkSonsLen(n, 3)
if n.sons[1].kind != nkEmpty: if n.sons[1].kind != nkEmpty:
base = skipTypes(semTypeNode(c, n.sons[1].sons[0], nil), skipPtrs) base = skipTypes(semTypeNode(c, n.sons[1].sons[0], nil), skipPtrs)
var concreteBase = skipGenericInvokation(base).skipTypes(skipPtrs) var concreteBase = skipGenericInvocation(base).skipTypes(skipPtrs)
if concreteBase.kind == tyObject and tfFinal notin concreteBase.flags: if concreteBase.kind == tyObject and tfFinal notin concreteBase.flags:
addInheritedFields(c, check, pos, concreteBase) addInheritedFields(c, check, pos, concreteBase)
else: else:
@ -777,12 +777,12 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
result = paramType result = paramType
of tyGenericBody: of tyGenericBody:
result = newTypeS(tyGenericInvokation, c) result = newTypeS(tyGenericInvocation, c)
result.rawAddSon(paramType) result.rawAddSon(paramType)
for i in 0 .. paramType.sonsLen - 2: for i in 0 .. paramType.sonsLen - 2:
if paramType.sons[i].kind == tyStatic: if paramType.sons[i].kind == tyStatic:
result.rawAddSon makeTypeFromExpr(c, ast.emptyNode) # aka 'tyUnkown' result.rawAddSon makeTypeFromExpr(c, ast.emptyNode) # aka 'tyUnknown'
else: else:
result.rawAddSon newTypeS(tyAnything, c) result.rawAddSon newTypeS(tyAnything, c)
@ -823,7 +823,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
result = liftBody result = liftBody
result.shouldHaveMeta result.shouldHaveMeta
of tyGenericInvokation: of tyGenericInvocation:
for i in 1 .. <paramType.sonsLen: for i in 1 .. <paramType.sonsLen:
let lifted = liftingWalk(paramType.sons[i]) let lifted = liftingWalk(paramType.sons[i])
if lifted != nil: paramType.sons[i] = lifted if lifted != nil: paramType.sons[i] = lifted
@ -991,7 +991,7 @@ proc semBlockType(c: PContext, n: PNode, prev: PType): PType =
closeScope(c) closeScope(c)
dec(c.p.nestedBlockCounter) dec(c.p.nestedBlockCounter)
proc semGenericParamInInvokation(c: PContext, n: PNode): PType = proc semGenericParamInInvocation(c: PContext, n: PNode): PType =
result = semTypeNode(c, n, nil) result = semTypeNode(c, n, nil)
proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType = proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
@ -1004,7 +1004,7 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
if t.kind == tyCompositeTypeClass and t.base.kind == tyGenericBody: if t.kind == tyCompositeTypeClass and t.base.kind == tyGenericBody:
t = t.base t = t.base
result = newOrPrevType(tyGenericInvokation, prev, c) result = newOrPrevType(tyGenericInvocation, prev, c)
addSonSkipIntLit(result, t) addSonSkipIntLit(result, t)
template addToResult(typ) = template addToResult(typ) =
@ -1015,7 +1015,7 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
if t.kind == tyForward: if t.kind == tyForward:
for i in countup(1, sonsLen(n)-1): for i in countup(1, sonsLen(n)-1):
var elem = semGenericParamInInvokation(c, n.sons[i]) var elem = semGenericParamInInvocation(c, n.sons[i])
addToResult(elem) addToResult(elem)
return return
elif t.kind != tyGenericBody: elif t.kind != tyGenericBody:

View file

@ -61,7 +61,7 @@ proc searchInstTypes*(key: PType): PType =
if inst.sons.len < key.sons.len: if inst.sons.len < key.sons.len:
# XXX: This happens for prematurely cached # XXX: This happens for prematurely cached
# types such as TChannel[empty]. Why? # types such as TChannel[empty]. Why?
# See the notes for PActor in handleGenericInvokation # See the notes for PActor in handleGenericInvocation
return return
block matchType: block matchType:
for j in 1 .. high(key.sons): for j in 1 .. high(key.sons):
@ -234,8 +234,8 @@ proc instCopyType*(cl: var TReplTypeVars, t: PType): PType =
result.flags.incl tfFromGeneric result.flags.incl tfFromGeneric
result.flags.excl tfInstClearedFlags result.flags.excl tfInstClearedFlags
proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType = proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
# tyGenericInvokation[A, tyGenericInvokation[A, B]] # tyGenericInvocation[A, tyGenericInvocation[A, B]]
# is difficult to handle: # is difficult to handle:
var body = t.sons[0] var body = t.sons[0]
if body.kind != tyGenericBody: internalError(cl.info, "no generic body") if body.kind != tyGenericBody: internalError(cl.info, "no generic body")
@ -278,7 +278,7 @@ proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType =
for i in countup(1, sonsLen(t) - 1): for i in countup(1, sonsLen(t) - 1):
var x = replaceTypeVarsT(cl, t.sons[i]) var x = replaceTypeVarsT(cl, t.sons[i])
assert x.kind != tyGenericInvokation assert x.kind != tyGenericInvocation
header.sons[i] = x header.sons[i] = x
propagateToOwner(header, x) propagateToOwner(header, x)
idTablePut(cl.typeMap, body.sons[i-1], x) idTablePut(cl.typeMap, body.sons[i-1], x)
@ -295,7 +295,7 @@ proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType =
#newbody.callConv = body.callConv #newbody.callConv = body.callConv
# This type may be a generic alias and we want to resolve it here. # This type may be a generic alias and we want to resolve it here.
# One step is enough, because the recursive nature of # One step is enough, because the recursive nature of
# handleGenericInvokation will handle the alias-to-alias-to-alias case # handleGenericInvocation will handle the alias-to-alias-to-alias case
if newbody.isGenericAlias: newbody = newbody.skipGenericAlias if newbody.isGenericAlias: newbody = newbody.skipGenericAlias
rawAddSon(result, newbody) rawAddSon(result, newbody)
checkPartialConstructedType(cl.info, newbody) checkPartialConstructedType(cl.info, newbody)
@ -359,8 +359,8 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
if lookup != nil: return lookup if lookup != nil: return lookup
case t.kind case t.kind
of tyGenericInvokation: of tyGenericInvocation:
result = handleGenericInvokation(cl, t) result = handleGenericInvocation(cl, t)
of tyGenericBody: of tyGenericBody:
localError(cl.info, errCannotInstantiateX, typeToString(t)) localError(cl.info, errCannotInstantiateX, typeToString(t))

View file

@ -153,8 +153,8 @@ proc sumGeneric(t: PType): int =
of tyVar: of tyVar:
# but do not make 'var T' more specific than 'T'! # but do not make 'var T' more specific than 'T'!
t = t.sons[0] t = t.sons[0]
of tyGenericInvokation, tyTuple: of tyGenericInvocation, tyTuple:
result = ord(t.kind == tyGenericInvokation) result = ord(t.kind == tyGenericInvocation)
for i in 0 .. <t.len: result += t.sons[i].sumGeneric for i in 0 .. <t.len: result += t.sons[i].sumGeneric
break break
of tyProc: of tyProc:
@ -262,7 +262,7 @@ proc concreteType(c: TCandidate, t: PType): PType =
# example code that triggers it: # example code that triggers it:
# proc sort[T](cmp: proc(a, b: T): int = cmp) # proc sort[T](cmp: proc(a, b: T): int = cmp)
if result.kind != tyGenericParam: break if result.kind != tyGenericParam: break
of tyGenericInvokation: of tyGenericInvocation:
internalError("cannot resolve type: " & typeToString(t)) internalError("cannot resolve type: " & typeToString(t))
result = t result = t
else: else:
@ -585,7 +585,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
if a.kind == tyGenericInst and if a.kind == tyGenericInst and
skipTypes(f, {tyVar}).kind notin { skipTypes(f, {tyVar}).kind notin {
tyGenericBody, tyGenericInvokation, tyGenericBody, tyGenericInvocation,
tyGenericInst, tyGenericParam} + tyTypeClasses: tyGenericInst, tyGenericParam} + tyTypeClasses:
return typeRel(c, f, lastSon(a)) return typeRel(c, f, lastSon(a))
@ -877,10 +877,10 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
let ff = lastSon(f) let ff = lastSon(f)
if ff != nil: result = typeRel(c, ff, a) if ff != nil: result = typeRel(c, ff, a)
of tyGenericInvokation: of tyGenericInvocation:
var x = a.skipGenericAlias var x = a.skipGenericAlias
if x.kind == tyGenericInvokation or f.sons[0].kind != tyGenericBody: if x.kind == tyGenericInvocation or f.sons[0].kind != tyGenericBody:
#InternalError("typeRel: tyGenericInvokation -> tyGenericInvokation") #InternalError("typeRel: tyGenericInvocation -> tyGenericInvocation")
# simply no match for now: # simply no match for now:
discard discard
elif x.kind == tyGenericInst and elif x.kind == tyGenericInst and
@ -897,7 +897,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
# we steal the generic parameters from the tyGenericBody: # we steal the generic parameters from the tyGenericBody:
for i in countup(1, sonsLen(f) - 1): for i in countup(1, sonsLen(f) - 1):
var x = PType(idTableGet(c.bindings, f.sons[0].sons[i - 1])) var x = PType(idTableGet(c.bindings, f.sons[0].sons[i - 1]))
if x == nil or x.kind in {tyGenericInvokation, tyGenericParam}: if x == nil or x.kind in {tyGenericInvocation, tyGenericParam}:
internalError("wrong instantiated type!") internalError("wrong instantiated type!")
put(c.bindings, f.sons[i], x) put(c.bindings, f.sons[i], x)

View file

@ -396,7 +396,7 @@ proc rangeToStr(n: PNode): string =
const const
typeToStr: array[TTypeKind, string] = ["None", "bool", "Char", "empty", typeToStr: array[TTypeKind, string] = ["None", "bool", "Char", "empty",
"Array Constructor [$1]", "nil", "expr", "stmt", "typeDesc", "Array Constructor [$1]", "nil", "expr", "stmt", "typeDesc",
"GenericInvokation", "GenericBody", "GenericInst", "GenericParam", "GenericInvocation", "GenericBody", "GenericInst", "GenericParam",
"distinct $1", "enum", "ordinal[$1]", "array[$1, $2]", "object", "tuple", "distinct $1", "enum", "ordinal[$1]", "array[$1, $2]", "object", "tuple",
"set[$1]", "range[$1]", "ptr ", "ref ", "var ", "seq[$1]", "proc", "set[$1]", "range[$1]", "ptr ", "ref ", "var ", "seq[$1]", "proc",
"pointer", "OpenArray[$1]", "string", "CString", "Forward", "pointer", "OpenArray[$1]", "string", "CString", "Forward",
@ -432,9 +432,9 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
result = $t.n.intVal result = $t.n.intVal
else: else:
result = "int literal(" & $t.n.intVal & ")" result = "int literal(" & $t.n.intVal & ")"
of tyGenericBody, tyGenericInst, tyGenericInvokation: of tyGenericBody, tyGenericInst, tyGenericInvocation:
result = typeToString(t.sons[0]) & '[' result = typeToString(t.sons[0]) & '['
for i in countup(1, sonsLen(t) -1 -ord(t.kind != tyGenericInvokation)): for i in countup(1, sonsLen(t) -1 -ord(t.kind != tyGenericInvocation)):
if i > 1: add(result, ", ") if i > 1: add(result, ", ")
add(result, typeToString(t.sons[i], preferGenericArg)) add(result, typeToString(t.sons[i], preferGenericArg))
add(result, ']') add(result, ']')
@ -941,7 +941,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
result = sameChildrenAux(a, b, c) and sameFlags(a, b) result = sameChildrenAux(a, b, c) and sameFlags(a, b)
if result and ExactGenericParams in c.flags: if result and ExactGenericParams in c.flags:
result = a.sym.position == b.sym.position result = a.sym.position == b.sym.position
of tyGenericInvokation, tyGenericBody, tySequence, of tyGenericInvocation, tyGenericBody, tySequence,
tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr, tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr,
tyArray, tyProc, tyConst, tyMutable, tyVarargs, tyIter, tyArray, tyProc, tyConst, tyMutable, tyVarargs, tyIter,
tyOrdinal, tyTypeClasses, tyFieldAccessor: tyOrdinal, tyTypeClasses, tyFieldAccessor:
@ -1087,7 +1087,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
if taField notin flags: result = t if taField notin flags: result = t
of tyTypeClasses: of tyTypeClasses:
if not (tfGenericTypeParam in t.flags or taField notin flags): result = t if not (tfGenericTypeParam in t.flags or taField notin flags): result = t
of tyGenericBody, tyGenericParam, tyGenericInvokation, of tyGenericBody, tyGenericParam, tyGenericInvocation,
tyNone, tyForward, tyFromExpr, tyFieldAccessor: tyNone, tyForward, tyFromExpr, tyFieldAccessor:
result = t result = t
of tyNil: of tyNil:

View file

@ -18,7 +18,7 @@ Advanced commands:
track a file, currently not saved to disk track a file, currently not saved to disk
--suggest suggest all possible symbols at position --suggest suggest all possible symbols at position
--def list all possible definitions at position --def list all possible definitions at position
--context list possible invokation context --context list possible invocation context
--usages list all usages of the symbol at position --usages list all usages of the symbol at position
--eval evaluates an expression --eval evaluates an expression
//serve start the compiler as a service mode (CAAS) //serve start the compiler as a service mode (CAAS)

View file

@ -27,7 +27,7 @@ integrations <https://github.com/Araq/Nim/wiki/Editor-Support>`_
already available. already available.
Idetools invokation Idetools invocation
=================== ===================
Specifying the location of the query Specifying the location of the query
@ -35,7 +35,7 @@ Specifying the location of the query
All of the available idetools commands require you to specify a All of the available idetools commands require you to specify a
query location through the ``--track`` or ``--trackDirty`` switches. query location through the ``--track`` or ``--trackDirty`` switches.
The general idetools invokations are:: The general idetools invocations are::
nim idetools --track:FILE,LINE,COL <switches> proj.nim nim idetools --track:FILE,LINE,COL <switches> proj.nim
@ -129,7 +129,7 @@ the suggestions sorted first by scope (from innermost to outermost)
and then by item name. and then by item name.
Invokation context Invocation context
------------------ ------------------
The ``--context`` idetools switch is very similar to the suggestions The ``--context`` idetools switch is very similar to the suggestions

View file

@ -236,7 +236,7 @@ too. Type converters fall into this category:
If in the above example module ``B`` is re-compiled, but ``A`` is not then If in the above example module ``B`` is re-compiled, but ``A`` is not then
``B`` needs to be aware of ``toBool`` even though ``toBool`` is not referenced ``B`` needs to be aware of ``toBool`` even though ``toBool`` is not referenced
in ``B`` *explicitely*. in ``B`` *explicitly*.
Both the multi method and the type converter problems are solved by storing Both the multi method and the type converter problems are solved by storing
them in special sections in the ROD file that are loaded *unconditionally* them in special sections in the ROD file that are loaded *unconditionally*

View file

@ -270,13 +270,13 @@ when defined(withUpdate):
echo("Fetching updates from repo...") echo("Fetching updates from repo...")
var pullout = execCmdEx(git & " pull origin master") var pullout = execCmdEx(git & " pull origin master")
if pullout[1] != 0: if pullout[1] != 0:
quit("An error has occured.") quit("An error has occurred.")
else: else:
if pullout[0].startsWith("Already up-to-date."): if pullout[0].startsWith("Already up-to-date."):
quit("No new changes fetched from the repo. " & quit("No new changes fetched from the repo. " &
"Local branch must be ahead of it. Exiting...") "Local branch must be ahead of it. Exiting...")
else: else:
quit("An error has occured.") quit("An error has occurred.")
else: else:
echo("No repo or executable found!") echo("No repo or executable found!")

View file

@ -76,7 +76,7 @@ type
TNimrodTypeKind* = enum TNimrodTypeKind* = enum
ntyNone, ntyBool, ntyChar, ntyEmpty, ntyNone, ntyBool, ntyChar, ntyEmpty,
ntyArrayConstr, ntyNil, ntyExpr, ntyStmt, ntyArrayConstr, ntyNil, ntyExpr, ntyStmt,
ntyTypeDesc, ntyGenericInvokation, ntyGenericBody, ntyGenericInst, ntyTypeDesc, ntyGenericInvocation, ntyGenericBody, ntyGenericInst,
ntyGenericParam, ntyDistinct, ntyEnum, ntyOrdinal, ntyGenericParam, ntyDistinct, ntyEnum, ntyOrdinal,
ntyArray, ntyObject, ntyTuple, ntySet, ntyArray, ntyObject, ntyTuple, ntySet,
ntyRange, ntyPtr, ntyRef, ntyVar, ntyRange, ntyPtr, ntyRef, ntyVar,

View file

@ -320,7 +320,7 @@ template foldl*(sequence, operation: expr): expr =
## ##
## The ``operation`` parameter should be an expression which uses the ## The ``operation`` parameter should be an expression which uses the
## variables ``a`` and ``b`` for each step of the fold. Since this is a left ## variables ``a`` and ``b`` for each step of the fold. Since this is a left
## fold, for non associative binary operations like substraction think that ## fold, for non associative binary operations like subtraction think that
## the sequence of numbers 1, 2 and 3 will be parenthesized as (((1) - 2) - ## the sequence of numbers 1, 2 and 3 will be parenthesized as (((1) - 2) -
## 3). Example: ## 3). Example:
## ##
@ -328,12 +328,12 @@ template foldl*(sequence, operation: expr): expr =
## let ## let
## numbers = @[5, 9, 11] ## numbers = @[5, 9, 11]
## addition = foldl(numbers, a + b) ## addition = foldl(numbers, a + b)
## substraction = foldl(numbers, a - b) ## subtraction = foldl(numbers, a - b)
## multiplication = foldl(numbers, a * b) ## multiplication = foldl(numbers, a * b)
## words = @["nim", "is", "cool"] ## words = @["nim", "is", "cool"]
## concatenation = foldl(words, a & b) ## concatenation = foldl(words, a & b)
## assert addition == 25, "Addition is (((5)+9)+11)" ## assert addition == 25, "Addition is (((5)+9)+11)"
## assert substraction == -15, "Substraction is (((5)-9)-11)" ## assert subtraction == -15, "Substraction is (((5)-9)-11)"
## assert multiplication == 495, "Multiplication is (((5)*9)*11)" ## assert multiplication == 495, "Multiplication is (((5)*9)*11)"
## assert concatenation == "nimiscool" ## assert concatenation == "nimiscool"
assert sequence.len > 0, "Can't fold empty sequences" assert sequence.len > 0, "Can't fold empty sequences"
@ -356,7 +356,7 @@ template foldr*(sequence, operation: expr): expr =
## ##
## The ``operation`` parameter should be an expression which uses the ## The ``operation`` parameter should be an expression which uses the
## variables ``a`` and ``b`` for each step of the fold. Since this is a right ## variables ``a`` and ``b`` for each step of the fold. Since this is a right
## fold, for non associative binary operations like substraction think that ## fold, for non associative binary operations like subtraction think that
## the sequence of numbers 1, 2 and 3 will be parenthesized as (1 - (2 - ## the sequence of numbers 1, 2 and 3 will be parenthesized as (1 - (2 -
## (3))). Example: ## (3))). Example:
## ##
@ -364,12 +364,12 @@ template foldr*(sequence, operation: expr): expr =
## let ## let
## numbers = @[5, 9, 11] ## numbers = @[5, 9, 11]
## addition = foldr(numbers, a + b) ## addition = foldr(numbers, a + b)
## substraction = foldr(numbers, a - b) ## subtraction = foldr(numbers, a - b)
## multiplication = foldr(numbers, a * b) ## multiplication = foldr(numbers, a * b)
## words = @["nim", "is", "cool"] ## words = @["nim", "is", "cool"]
## concatenation = foldr(words, a & b) ## concatenation = foldr(words, a & b)
## assert addition == 25, "Addition is (5+(9+(11)))" ## assert addition == 25, "Addition is (5+(9+(11)))"
## assert substraction == 7, "Substraction is (5-(9-(11)))" ## assert subtraction == 7, "Substraction is (5-(9-(11)))"
## assert multiplication == 495, "Multiplication is (5*(9*(11)))" ## assert multiplication == 495, "Multiplication is (5*(9*(11)))"
## assert concatenation == "nimiscool" ## assert concatenation == "nimiscool"
assert sequence.len > 0, "Can't fold empty sequences" assert sequence.len > 0, "Can't fold empty sequences"
@ -507,12 +507,12 @@ when isMainModule:
let let
numbers = @[5, 9, 11] numbers = @[5, 9, 11]
addition = foldl(numbers, a + b) addition = foldl(numbers, a + b)
substraction = foldl(numbers, a - b) subtraction = foldl(numbers, a - b)
multiplication = foldl(numbers, a * b) multiplication = foldl(numbers, a * b)
words = @["nim", "is", "cool"] words = @["nim", "is", "cool"]
concatenation = foldl(words, a & b) concatenation = foldl(words, a & b)
assert addition == 25, "Addition is (((5)+9)+11)" assert addition == 25, "Addition is (((5)+9)+11)"
assert substraction == -15, "Substraction is (((5)-9)-11)" assert subtraction == -15, "Substraction is (((5)-9)-11)"
assert multiplication == 495, "Multiplication is (((5)*9)*11)" assert multiplication == 495, "Multiplication is (((5)*9)*11)"
assert concatenation == "nimiscool" assert concatenation == "nimiscool"
@ -520,12 +520,12 @@ when isMainModule:
let let
numbers = @[5, 9, 11] numbers = @[5, 9, 11]
addition = foldr(numbers, a + b) addition = foldr(numbers, a + b)
substraction = foldr(numbers, a - b) subtraction = foldr(numbers, a - b)
multiplication = foldr(numbers, a * b) multiplication = foldr(numbers, a * b)
words = @["nim", "is", "cool"] words = @["nim", "is", "cool"]
concatenation = foldr(words, a & b) concatenation = foldr(words, a & b)
assert addition == 25, "Addition is (5+(9+(11)))" assert addition == 25, "Addition is (5+(9+(11)))"
assert substraction == 7, "Substraction is (5-(9-(11)))" assert subtraction == 7, "Substraction is (5-(9-(11)))"
assert multiplication == 495, "Multiplication is (5*(9*(11)))" assert multiplication == 495, "Multiplication is (5*(9*(11)))"
assert concatenation == "nimiscool" assert concatenation == "nimiscool"

View file

@ -392,7 +392,7 @@ proc parseColor*(name: string): Color =
result = Color(parseHexInt(name)) result = Color(parseHexInt(name))
else: else:
var idx = binaryStrSearch(colorNames, name) var idx = binaryStrSearch(colorNames, name)
if idx < 0: raise newException(ValueError, "unkown color: " & name) if idx < 0: raise newException(ValueError, "unknown color: " & name)
result = colorNames[idx][1] result = colorNames[idx][1]
proc isColor*(name: string): bool = proc isColor*(name: string): bool =

View file

@ -552,7 +552,7 @@ proc parse(x: var XmlParser, errors: var seq[string]): XmlNode =
proc parseHtml*(s: Stream, filename: string, proc parseHtml*(s: Stream, filename: string,
errors: var seq[string]): XmlNode = errors: var seq[string]): XmlNode =
## parses the XML from stream `s` and returns a ``PXmlNode``. Every ## parses the XML from stream `s` and returns a ``PXmlNode``. Every
## occured parsing error is added to the `errors` sequence. ## occurred parsing error is added to the `errors` sequence.
var x: XmlParser var x: XmlParser
open(x, s, filename, {reportComments, reportWhitespace}) open(x, s, filename, {reportComments, reportWhitespace})
next(x) next(x)
@ -581,7 +581,7 @@ proc parseHtml*(s: Stream): XmlNode =
proc loadHtml*(path: string, errors: var seq[string]): XmlNode = proc loadHtml*(path: string, errors: var seq[string]): XmlNode =
## Loads and parses HTML from file specified by ``path``, and returns ## Loads and parses HTML from file specified by ``path``, and returns
## a ``PXmlNode``. Every occured parsing error is added to ## a ``PXmlNode``. Every occurred parsing error is added to
## the `errors` sequence. ## the `errors` sequence.
var s = newFileStream(path, fmRead) var s = newFileStream(path, fmRead)
if s == nil: raise newException(IOError, "Unable to read file: " & path) if s == nil: raise newException(IOError, "Unable to read file: " & path)

View file

@ -55,7 +55,7 @@ import
type type
JsonEventKind* = enum ## enumeration of all events that may occur when parsing JsonEventKind* = enum ## enumeration of all events that may occur when parsing
jsonError, ## an error ocurred during parsing jsonError, ## an error occurred during parsing
jsonEof, ## end of file reached jsonEof, ## end of file reached
jsonString, ## a string literal jsonString, ## a string literal
jsonInt, ## an integer literal jsonInt, ## an integer literal

View file

@ -258,7 +258,7 @@ proc socketError*(socket: Socket, err: int = -1, async = false,
of SSL_ERROR_WANT_X509_LOOKUP: of SSL_ERROR_WANT_X509_LOOKUP:
raiseSSLError("Function for x509 lookup has been called.") raiseSSLError("Function for x509 lookup has been called.")
of SSL_ERROR_SYSCALL: of SSL_ERROR_SYSCALL:
var errStr = "IO error has occured " var errStr = "IO error has occurred "
let sslErr = ErrPeekLastError() let sslErr = ErrPeekLastError()
if sslErr == 0 and err == 0: if sslErr == 0 and err == 0:
errStr.add "because an EOF was observed that violates the protocol" errStr.add "because an EOF was observed that violates the protocol"

View file

@ -185,7 +185,7 @@ const
proc osErrorMsg*(): string {.rtl, extern: "nos$1", deprecated.} = proc osErrorMsg*(): string {.rtl, extern: "nos$1", deprecated.} =
## Retrieves the operating system's error flag, ``errno``. ## Retrieves the operating system's error flag, ``errno``.
## On Windows ``GetLastError`` is checked before ``errno``. ## On Windows ``GetLastError`` is checked before ``errno``.
## Returns "" if no error occured. ## Returns "" if no error occurred.
## ##
## **Deprecated since version 0.9.4**: use the other ``osErrorMsg`` proc. ## **Deprecated since version 0.9.4**: use the other ``osErrorMsg`` proc.
@ -1099,7 +1099,7 @@ when defined(windows):
var var
env = getEnvironmentStringsW() env = getEnvironmentStringsW()
e = env e = env
if e == nil: return # an error occured if e == nil: return # an error occurred
while true: while true:
var eend = strEnd(e) var eend = strEnd(e)
add(environment, $e) add(environment, $e)
@ -1110,7 +1110,7 @@ when defined(windows):
var var
env = getEnvironmentStringsA() env = getEnvironmentStringsA()
e = env e = env
if e == nil: return # an error occured if e == nil: return # an error occurred
while true: while true:
var eend = strEnd(e) var eend = strEnd(e)
add(environment, $e) add(environment, $e)

View file

@ -146,7 +146,7 @@ proc startProcess*(command: string,
## of `args` to `command` carefully escaping/quoting any special characters, ## of `args` to `command` carefully escaping/quoting any special characters,
## since it will be passed *as is* to the system shell. Each system/shell may ## since it will be passed *as is* to the system shell. Each system/shell may
## feature different escaping rules, so try to avoid this kind of shell ## feature different escaping rules, so try to avoid this kind of shell
## invokation if possible as it leads to non portable software. ## invocation if possible as it leads to non portable software.
## ##
## Return value: The newly created process object. Nil is never returned, ## Return value: The newly created process object. Nil is never returned,
## but ``EOS`` is raised in case of an error. ## but ``EOS`` is raised in case of an error.

View file

@ -35,7 +35,7 @@ type
cfgSectionStart, ## a ``[section]`` has been parsed cfgSectionStart, ## a ``[section]`` has been parsed
cfgKeyValuePair, ## a ``key=value`` pair has been detected cfgKeyValuePair, ## a ``key=value`` pair has been detected
cfgOption, ## a ``--key=value`` command line option cfgOption, ## a ``--key=value`` command line option
cfgError ## an error ocurred during parsing cfgError ## an error occurred during parsing
CfgEvent* = object of RootObj ## describes a parsing event CfgEvent* = object of RootObj ## describes a parsing event
case kind*: CfgEventKind ## the kind of the event case kind*: CfgEventKind ## the kind of the event

View file

@ -240,7 +240,7 @@ proc parseBiggestFloat*(s: string, number: var BiggestFloat, start = 0): int {.
proc parseFloat*(s: string, number: var float, start = 0): int {. proc parseFloat*(s: string, number: var float, start = 0): int {.
rtl, extern: "npuParseFloat", noSideEffect.} = rtl, extern: "npuParseFloat", noSideEffect.} =
## parses a float starting at `start` and stores the value into `number`. ## parses a float starting at `start` and stores the value into `number`.
## Result is the number of processed chars or 0 if there occured a parsing ## Result is the number of processed chars or 0 if there occurred a parsing
## error. ## error.
var bf: BiggestFloat var bf: BiggestFloat
result = parseBiggestFloat(s, bf, start) result = parseBiggestFloat(s, bf, start)

View file

@ -57,7 +57,7 @@ import
type type
XmlEventKind* = enum ## enumation of all events that may occur when parsing XmlEventKind* = enum ## enumation of all events that may occur when parsing
xmlError, ## an error ocurred during parsing xmlError, ## an error occurred during parsing
xmlEof, ## end of file reached xmlEof, ## end of file reached
xmlCharData, ## character data xmlCharData, ## character data
xmlWhitespace, ## whitespace has been parsed xmlWhitespace, ## whitespace has been parsed

View file

@ -1467,7 +1467,7 @@ proc recvAsync*(socket: Socket, s: var TaintedString): bool {.
of SSL_ERROR_ZERO_RETURN: of SSL_ERROR_ZERO_RETURN:
raiseSslError("TLS/SSL connection failed to initiate, socket closed prematurely.") raiseSslError("TLS/SSL connection failed to initiate, socket closed prematurely.")
of SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: of SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT:
raiseSslError("Unexpected error occured.") # This should just not happen. raiseSslError("Unexpected error occurred.") # This should just not happen.
of SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_READ: of SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_READ:
return false return false
of SSL_ERROR_WANT_X509_LOOKUP: of SSL_ERROR_WANT_X509_LOOKUP:
@ -1610,7 +1610,7 @@ proc sendAsync*(socket: Socket, data: string): int {.tags: [WriteIOEffect].} =
of SSL_ERROR_ZERO_RETURN: of SSL_ERROR_ZERO_RETURN:
raiseSslError("TLS/SSL connection failed to initiate, socket closed prematurely.") raiseSslError("TLS/SSL connection failed to initiate, socket closed prematurely.")
of SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: of SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT:
raiseSslError("Unexpected error occured.") # This should just not happen. raiseSslError("Unexpected error occurred.") # This should just not happen.
of SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_READ: of SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_READ:
return 0 return 0
of SSL_ERROR_WANT_X509_LOOKUP: of SSL_ERROR_WANT_X509_LOOKUP:

View file

@ -122,41 +122,41 @@ proc read[T](s: Stream, result: var T) =
raise newEIO("cannot read from stream") raise newEIO("cannot read from stream")
proc readChar*(s: Stream): char = proc readChar*(s: Stream): char =
## reads a char from the stream `s`. Raises `EIO` if an error occured. ## reads a char from the stream `s`. Raises `EIO` if an error occurred.
## Returns '\0' as an EOF marker. ## Returns '\0' as an EOF marker.
if readData(s, addr(result), sizeof(result)) != 1: result = '\0' if readData(s, addr(result), sizeof(result)) != 1: result = '\0'
proc readBool*(s: Stream): bool = proc readBool*(s: Stream): bool =
## reads a bool from the stream `s`. Raises `EIO` if an error occured. ## reads a bool from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readInt8*(s: Stream): int8 = proc readInt8*(s: Stream): int8 =
## reads an int8 from the stream `s`. Raises `EIO` if an error occured. ## reads an int8 from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readInt16*(s: Stream): int16 = proc readInt16*(s: Stream): int16 =
## reads an int16 from the stream `s`. Raises `EIO` if an error occured. ## reads an int16 from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readInt32*(s: Stream): int32 = proc readInt32*(s: Stream): int32 =
## reads an int32 from the stream `s`. Raises `EIO` if an error occured. ## reads an int32 from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readInt64*(s: Stream): int64 = proc readInt64*(s: Stream): int64 =
## reads an int64 from the stream `s`. Raises `EIO` if an error occured. ## reads an int64 from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readFloat32*(s: Stream): float32 = proc readFloat32*(s: Stream): float32 =
## reads a float32 from the stream `s`. Raises `EIO` if an error occured. ## reads a float32 from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readFloat64*(s: Stream): float64 = proc readFloat64*(s: Stream): float64 =
## reads a float64 from the stream `s`. Raises `EIO` if an error occured. ## reads a float64 from the stream `s`. Raises `EIO` if an error occurred.
read(s, result) read(s, result)
proc readStr*(s: Stream, length: int): TaintedString = proc readStr*(s: Stream, length: int): TaintedString =
## reads a string of length `length` from the stream `s`. Raises `EIO` if ## reads a string of length `length` from the stream `s`. Raises `EIO` if
## an error occured. ## an error occurred.
result = newString(length).TaintedString result = newString(length).TaintedString
var L = readData(s, addr(string(result)[0]), length) var L = readData(s, addr(string(result)[0]), length)
if L != length: setLen(result.string, L) if L != length: setLen(result.string, L)
@ -183,7 +183,7 @@ proc readLine*(s: Stream, line: var TaintedString): bool =
proc readLine*(s: Stream): TaintedString = proc readLine*(s: Stream): TaintedString =
## Reads a line from a stream `s`. Note: This is not very efficient. Raises ## Reads a line from a stream `s`. Note: This is not very efficient. Raises
## `EIO` if an error occured. ## `EIO` if an error occurred.
result = TaintedString"" result = TaintedString""
while true: while true:
var c = readChar(s) var c = readChar(s)

View file

@ -103,7 +103,7 @@ proc parse(x: var XmlParser, errors: var seq[string]): XmlNode =
proc parseXml*(s: Stream, filename: string, proc parseXml*(s: Stream, filename: string,
errors: var seq[string]): XmlNode = errors: var seq[string]): XmlNode =
## parses the XML from stream `s` and returns a ``PXmlNode``. Every ## parses the XML from stream `s` and returns a ``PXmlNode``. Every
## occured parsing error is added to the `errors` sequence. ## occurred parsing error is added to the `errors` sequence.
var x: XmlParser var x: XmlParser
open(x, s, filename, {reportComments}) open(x, s, filename, {reportComments})
while true: while true:
@ -129,7 +129,7 @@ proc parseXml*(s: Stream): XmlNode =
proc loadXml*(path: string, errors: var seq[string]): XmlNode = proc loadXml*(path: string, errors: var seq[string]): XmlNode =
## Loads and parses XML from file specified by ``path``, and returns ## Loads and parses XML from file specified by ``path``, and returns
## a ``PXmlNode``. Every occured parsing error is added to the `errors` ## a ``PXmlNode``. Every occurred parsing error is added to the `errors`
## sequence. ## sequence.
var s = newFileStream(path, fmRead) var s = newFileStream(path, fmRead)
if s == nil: raise newException(IOError, "Unable to read file: " & path) if s == nil: raise newException(IOError, "Unable to read file: " & path)

View file

@ -357,7 +357,7 @@ type
## ##
## See the full `exception hierarchy`_. ## See the full `exception hierarchy`_.
IOError* = object of SystemError ## \ IOError* = object of SystemError ## \
## Raised if an IO error occured. ## Raised if an IO error occurred.
## ##
## See the full `exception hierarchy`_. ## See the full `exception hierarchy`_.
OSError* = object of SystemError ## \ OSError* = object of SystemError ## \
@ -374,7 +374,7 @@ type
## ##
## See the full `exception hierarchy`_. ## See the full `exception hierarchy`_.
ArithmeticError* = object of Exception ## \ ArithmeticError* = object of Exception ## \
## Raised if any kind of arithmetic error occured. ## Raised if any kind of arithmetic error occurred.
## ##
## See the full `exception hierarchy`_. ## See the full `exception hierarchy`_.
DivByZeroError* = object of ArithmeticError ## \ DivByZeroError* = object of ArithmeticError ## \

View file

@ -26,7 +26,7 @@ type
tyExpr, tyExpr,
tyStmt, tyStmt,
tyTypeDesc, tyTypeDesc,
tyGenericInvokation, # ``T[a, b]`` for types to invoke tyGenericInvocation, # ``T[a, b]`` for types to invoke
tyGenericBody, # ``T[a, b, body]`` last parameter is the body tyGenericBody, # ``T[a, b, body]`` last parameter is the body
tyGenericInst, # ``T[a, b, realInstance]`` instantiated generic type tyGenericInst, # ``T[a, b, realInstance]`` instantiated generic type
tyGenericParam, # ``a`` in the example tyGenericParam, # ``a`` in the example

View file

@ -90,7 +90,7 @@ noclean:
// If the return value pointer is NULL, assume no return value. // If the return value pointer is NULL, assume no return value.
/* /*
Intel asm is weird. We have to explicitely specify 'DWORD PTR' in the nexr instruction, Intel asm is weird. We have to explicitly specify 'DWORD PTR' in the nexr instruction,
otherwise only one BYTE will be compared (instead of a DWORD)! otherwise only one BYTE will be compared (instead of a DWORD)!
*/ */
cmp DWORD PTR [ebp + 24], 0 cmp DWORD PTR [ebp + 24], 0

View file

@ -790,7 +790,7 @@ proc server_init*(argc: cint, argv: cstringArray, groups: cstringArray): cint{.
proc server_end*(){.cdecl, dynlib: lib, importc: "mysql_server_end".} proc server_end*(){.cdecl, dynlib: lib, importc: "mysql_server_end".}
# mysql_server_init/end need to be called when using libmysqld or # mysql_server_init/end need to be called when using libmysqld or
# libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so # libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
# you don't need to call it explicitely; but you need to call # you don't need to call it explicitly; but you need to call
# mysql_server_end() to free memory). The names are a bit misleading # mysql_server_end() to free memory). The names are a bit misleading
# (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general # (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
# names which suit well whether you're using libmysqld or libmysqlclient. We # names which suit well whether you're using libmysqld or libmysqlclient. We

View file

@ -231,7 +231,7 @@ proc history_truncate_file*(a2: cstring, a3: cint): cint{.cdecl,
# -1) If there was an error in expansion. # -1) If there was an error in expansion.
# 2) If the returned line should just be printed. # 2) If the returned line should just be printed.
# #
# If an error ocurred in expansion, then OUTPUT contains a descriptive # If an error occurred in expansion, then OUTPUT contains a descriptive
# error message. # error message.
proc history_expand*(a2: cstring, a3: cstringArray): cint{.cdecl, proc history_expand*(a2: cstring, a3: cstringArray): cint{.cdecl,

View file

@ -217,7 +217,7 @@ extern int history_truncate_file PARAMS((const char *, int));
-1) If there was an error in expansion. -1) If there was an error in expansion.
2) If the returned line should just be printed. 2) If the returned line should just be printed.
If an error ocurred in expansion, then OUTPUT contains a descriptive If an error occurred in expansion, then OUTPUT contains a descriptive
error message. */ error message. */
extern int history_expand PARAMS((char *, char **)); extern int history_expand PARAMS((char *, char **));

View file

@ -279,7 +279,7 @@ type
PSegmentQueryInfo* = ptr TSegmentQueryInfo PSegmentQueryInfo* = ptr TSegmentQueryInfo
#/ Segment query info struct. #/ Segment query info struct.
TSegmentQueryInfo*{.pf.} = object TSegmentQueryInfo*{.pf.} = object
shape*: PShape #/ The shape that was hit, NULL if no collision occured. shape*: PShape #/ The shape that was hit, NULL if no collision occurred.
t*: CpFloat #/ The normalized distance along the query segment in the range [0, 1]. t*: CpFloat #/ The normalized distance along the query segment in the range [0, 1].
n*: TVector #/ The normal of the surface hit. n*: TVector #/ The normal of the surface hit.
TShapeType*{.size: sizeof(cint).} = enum TShapeType*{.size: sizeof(cint).} = enum

View file

@ -8,7 +8,7 @@ proc compress*(source: string): string =
result.setLen destLen result.setLen destLen
var res = zlib.compress(cstring(result), addr destLen, cstring(source), sourceLen) var res = zlib.compress(cstring(result), addr destLen, cstring(source), sourceLen)
if res != Z_OK: if res != Z_OK:
echo "Error occured: ", res echo "Error occurred: ", res
elif destLen < result.len: elif destLen < result.len:
result.setLen(destLen) result.setLen(destLen)
@ -17,7 +17,7 @@ proc uncompress*(source: string, destLen: var int): string =
result.setLen destLen result.setLen destLen
var res = zlib.uncompress(cstring(result), addr destLen, cstring(source), source.len) var res = zlib.uncompress(cstring(result), addr destLen, cstring(source), source.len)
if res != Z_OK: if res != Z_OK:
echo "Error occured: ", res echo "Error occurred: ", res
when isMainModule: when isMainModule:

View file

@ -1,5 +1,5 @@
# Test for a hard to fix internal error # Test for a hard to fix internal error
# occured in the SDL library # occurred in the SDL library
{.push dynlib: "SDL.dll", callconv: cdecl.} {.push dynlib: "SDL.dll", callconv: cdecl.}

View file

@ -1203,7 +1203,7 @@ static inline int is_integer_btype(int bt)
bt == VT_INT || bt == VT_LLONG); bt == VT_INT || bt == VT_LLONG);
} }
/* check types for comparison or substraction of pointers */ /* check types for comparison or subtraction of pointers */
static void check_comparison_pointer_types(SValue *p1, SValue *p2, int op) static void check_comparison_pointer_types(SValue *p1, SValue *p2, int op)
{ {
CType *type1, *type2, tmp_type1, tmp_type2; CType *type1, *type2, tmp_type1, tmp_type2;