diff --git a/src/babel.nim b/src/babel.nim index f66782a..386bfc1 100644 --- a/src/babel.nim +++ b/src/babel.nim @@ -74,7 +74,7 @@ proc writeHelp() = quit(QuitSuccess) proc writeVersion() = - echo("babel v$# compiled at $# $#" % [babelVersion, compileDate, compileTime]) + echo("babel v$# compiled at $# $#" % [babelVersion, CompileDate, CompileTime]) quit(QuitSuccess) proc getBabelDir(options: TOptions): string = diff --git a/src/babelpkg/download.nim b/src/babelpkg/download.nim index f69be8a..9562edb 100644 --- a/src/babelpkg/download.nim +++ b/src/babelpkg/download.nim @@ -102,7 +102,7 @@ proc getVersionList*(tags: seq[string]): TTable[TVersion, string] = result = initTable[TVersion, string]() for tag in tags: if tag != "": - let i = skipUntil(tag, digits) # skip any chars before the version + let i = skipUntil(tag, Digits) # skip any chars before the version # TODO: Better checking, tags can have any names. Add warnings and such. result[newVersion(tag[i .. -1])] = tag diff --git a/src/babelpkg/packageinfo.nim b/src/babelpkg/packageinfo.nim index f71761e..ad56d8c 100644 --- a/src/babelpkg/packageinfo.nim +++ b/src/babelpkg/packageinfo.nim @@ -77,7 +77,7 @@ proc validatePackageInfo(pkgInfo: TPackageInfo, path: string) = if pkgInfo.backend notin ["c", "cc", "objc", "cpp", "js"]: raise newException(EBabel, "'" & pkgInfo.backend & "' is an invalid backend.") for c in pkgInfo.version: - if c notin ({'.'} + digits): + if c notin ({'.'} + Digits): raise newException(EBabel, "Version may only consist of numbers and the '.' character " & "but found '" & c & "'.") @@ -85,7 +85,7 @@ proc validatePackageInfo(pkgInfo: TPackageInfo, path: string) = proc parseRequires(req: string): TPkgTuple = try: if ' ' in req: - var i = skipUntil(req, whitespace) + var i = skipUntil(req, Whitespace) result.name = req[0 .. i].strip result.ver = parseVersionRange(req[i .. -1]) elif '#' in req: diff --git a/src/babelpkg/version.nim b/src/babelpkg/version.nim index fdf3a3c..bec66d7 100644 --- a/src/babelpkg/version.nim +++ b/src/babelpkg/version.nim @@ -34,15 +34,15 @@ type proc newVersion*(ver: string): TVersion = return TVersion(ver) proc newSpecial*(spe: string): TSpecial = return TSpecial(spe) -proc `$`*(ver: TVersion): String {.borrow.} +proc `$`*(ver: TVersion): string {.borrow.} proc hash*(ver: TVersion): THash {.borrow.} -proc `$`*(ver: TSpecial): String {.borrow.} +proc `$`*(ver: TSpecial): string {.borrow.} proc hash*(ver: TSpecial): THash {.borrow.} -proc `<`*(ver: TVersion, ver2: TVersion): Bool = +proc `<`*(ver: TVersion, ver2: TVersion): bool = var sVer = string(ver).split('.') var sVer2 = string(ver2).split('.') for i in 0..max(sVer.len, sVer2.len)-1: @@ -53,13 +53,13 @@ proc `<`*(ver: TVersion, ver2: TVersion): Bool = if i < sVer2.len: discard parseInt(sVer2[i], sVerI2) if sVerI < sVerI2: - return True + return true elif sVerI == sVerI2: nil else: - return False + return false -proc `==`*(ver: TVersion, ver2: TVersion): Bool = +proc `==`*(ver: TVersion, ver2: TVersion): bool = var sVer = string(ver).split('.') var sVer2 = string(ver2).split('.') for i in 0..max(sVer.len, sVer2.len)-1: @@ -72,15 +72,15 @@ proc `==`*(ver: TVersion, ver2: TVersion): Bool = if sVerI == sVerI2: result = true else: - return False + return false proc `==`*(spe: TSpecial, spe2: TSpecial): bool = return ($spe).toLower() == ($spe2).toLower() -proc `<=`*(ver: TVersion, ver2: TVersion): Bool = +proc `<=`*(ver: TVersion, ver2: TVersion): bool = return (ver == ver2) or (ver < ver2) -proc withinRange*(ver: TVersion, ran: PVersionRange): Bool = +proc withinRange*(ver: TVersion, ran: PVersionRange): bool = case ran.kind of verLater: return ver > ran.ver @@ -93,20 +93,20 @@ proc withinRange*(ver: TVersion, ran: PVersionRange): Bool = of verEq: return ver == ran.ver of verSpecial: - return False + return false of verIntersect: return withinRange(ver, ran.verILeft) and withinRange(ver, ran.verIRight) of verAny: - return True + return true -proc withinRange*(spe: TSpecial, ran: PVersionRange): Bool = +proc withinRange*(spe: TSpecial, ran: PVersionRange): bool = case ran.kind of verLater, verEarlier, verEqLater, verEqEarlier, verEq, verIntersect: - return False + return false of verSpecial: return spe == ran.spe of verAny: - return True + return true proc contains*(ran: PVersionRange, ver: TVersion): bool = return withinRange(ver, ran) @@ -144,7 +144,7 @@ proc parseVersionRange*(s: string): PVersionRange = var i = 0 var op = "" var version = "" - while True: + while true: case s[i] of '>', '<', '=': op.add(s[i]) @@ -181,7 +181,7 @@ proc parseVersionRange*(s: string): PVersionRange = raise newException(EParseVersion, "Unexpected char in version range: " & s[i]) inc(i) -proc `$`*(verRange: PVersionRange): String = +proc `$`*(verRange: PVersionRange): string = case verRange.kind of verLater: result = "> " @@ -219,7 +219,7 @@ proc newVRAny*(): PVersionRange = new(result) result.kind = verAny -proc newVREarlier*(ver: String): PVersionRange = +proc newVREarlier*(ver: string): PVersionRange = new(result) result.kind = verEarlier result.ver = newVersion(ver) @@ -281,4 +281,4 @@ when isMainModule: doAssert newSpecial("ab26saggdt362") notin sp - echo("Everything works!") \ No newline at end of file + echo("Everything works!")