mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
Fix spelling errors (#10379)
This commit is contained in:
@@ -230,7 +230,7 @@ proc semConv(c: PContext, n: PNode): PNode =
|
||||
# special case to make MyObject(x = 3) produce a nicer error message:
|
||||
if n[1].kind == nkExprEqExpr and
|
||||
targetType.skipTypes(abstractPtrs).kind == tyObject:
|
||||
localError(c.config, n.info, "object contruction uses ':', not '='")
|
||||
localError(c.config, n.info, "object construction uses ':', not '='")
|
||||
var op = semExprWithType(c, n.sons[1])
|
||||
if targetType.isMetaType:
|
||||
let final = inferWithMetatype(c, targetType, op, true)
|
||||
|
||||
@@ -85,9 +85,9 @@ elif doslikeFileSystem:
|
||||
const
|
||||
CurDir* = '.'
|
||||
ParDir* = ".."
|
||||
DirSep* = '\\' # seperator within paths
|
||||
DirSep* = '\\' # separator within paths
|
||||
AltSep* = '/'
|
||||
PathSep* = ';' # seperator between paths
|
||||
PathSep* = ';' # separator between paths
|
||||
FileSystemCaseSensitive* = false
|
||||
ExeExt* = "exe"
|
||||
ScriptExt* = "bat"
|
||||
|
||||
@@ -233,7 +233,7 @@ proc parseIPv4Address(addressStr: string): IpAddress =
|
||||
var
|
||||
byteCount = 0
|
||||
currentByte:uint16 = 0
|
||||
seperatorValid = false
|
||||
separatorValid = false
|
||||
|
||||
result.family = IpAddressFamily.IPv4
|
||||
|
||||
@@ -244,20 +244,20 @@ proc parseIPv4Address(addressStr: string): IpAddress =
|
||||
if currentByte > 255'u16:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Value is out of range")
|
||||
seperatorValid = true
|
||||
separatorValid = true
|
||||
elif addressStr[i] == '.': # IPv4 address separator
|
||||
if not seperatorValid or byteCount >= 3:
|
||||
if not separatorValid or byteCount >= 3:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. The address consists of too many groups")
|
||||
result.address_v4[byteCount] = cast[uint8](currentByte)
|
||||
currentByte = 0
|
||||
byteCount.inc
|
||||
seperatorValid = false
|
||||
separatorValid = false
|
||||
else:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Address contains an invalid character")
|
||||
|
||||
if byteCount != 3 or not seperatorValid:
|
||||
if byteCount != 3 or not separatorValid:
|
||||
raise newException(ValueError, "Invalid IP Address")
|
||||
result.address_v4[byteCount] = cast[uint8](currentByte)
|
||||
|
||||
@@ -272,7 +272,7 @@ proc parseIPv6Address(addressStr: string): IpAddress =
|
||||
groupCount = 0
|
||||
currentGroupStart = 0
|
||||
currentShort:uint32 = 0
|
||||
seperatorValid = true
|
||||
separatorValid = true
|
||||
dualColonGroup = -1
|
||||
lastWasColon = false
|
||||
v4StartPos = -1
|
||||
@@ -280,15 +280,15 @@ proc parseIPv6Address(addressStr: string): IpAddress =
|
||||
|
||||
for i,c in addressStr:
|
||||
if c == ':':
|
||||
if not seperatorValid:
|
||||
if not separatorValid:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Address contains an invalid seperator")
|
||||
"Invalid IP Address. Address contains an invalid separator")
|
||||
if lastWasColon:
|
||||
if dualColonGroup != -1:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Address contains more than one \"::\" seperator")
|
||||
"Invalid IP Address. Address contains more than one \"::\" separator")
|
||||
dualColonGroup = groupCount
|
||||
seperatorValid = false
|
||||
separatorValid = false
|
||||
elif i != 0 and i != high(addressStr):
|
||||
if groupCount >= 8:
|
||||
raise newException(ValueError,
|
||||
@@ -297,7 +297,7 @@ proc parseIPv6Address(addressStr: string): IpAddress =
|
||||
result.address_v6[groupCount*2+1] = cast[uint8](currentShort and 0xFF)
|
||||
currentShort = 0
|
||||
groupCount.inc()
|
||||
if dualColonGroup != -1: seperatorValid = false
|
||||
if dualColonGroup != -1: separatorValid = false
|
||||
elif i == 0: # only valid if address starts with ::
|
||||
if addressStr[1] != ':':
|
||||
raise newException(ValueError,
|
||||
@@ -309,11 +309,11 @@ proc parseIPv6Address(addressStr: string): IpAddress =
|
||||
lastWasColon = true
|
||||
currentGroupStart = i + 1
|
||||
elif c == '.': # Switch to parse IPv4 mode
|
||||
if i < 3 or not seperatorValid or groupCount >= 7:
|
||||
if i < 3 or not separatorValid or groupCount >= 7:
|
||||
raise newException(ValueError, "Invalid IP Address")
|
||||
v4StartPos = currentGroupStart
|
||||
currentShort = 0
|
||||
seperatorValid = false
|
||||
separatorValid = false
|
||||
break
|
||||
elif c in strutils.HexDigits:
|
||||
if c in strutils.Digits: # Normal digit
|
||||
@@ -326,14 +326,14 @@ proc parseIPv6Address(addressStr: string): IpAddress =
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Value is out of range")
|
||||
lastWasColon = false
|
||||
seperatorValid = true
|
||||
separatorValid = true
|
||||
else:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Address contains an invalid character")
|
||||
|
||||
|
||||
if v4StartPos == -1: # Don't parse v4. Copy the remaining v6 stuff
|
||||
if seperatorValid: # Copy remaining data
|
||||
if separatorValid: # Copy remaining data
|
||||
if groupCount >= 8:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. The address consists of too many groups")
|
||||
@@ -347,19 +347,19 @@ proc parseIPv6Address(addressStr: string): IpAddress =
|
||||
if currentShort > 255'u32:
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Value is out of range")
|
||||
seperatorValid = true
|
||||
separatorValid = true
|
||||
elif c == '.': # IPv4 address separator
|
||||
if not seperatorValid or byteCount >= 3:
|
||||
if not separatorValid or byteCount >= 3:
|
||||
raise newException(ValueError, "Invalid IP Address")
|
||||
result.address_v6[groupCount*2 + byteCount] = cast[uint8](currentShort)
|
||||
currentShort = 0
|
||||
byteCount.inc()
|
||||
seperatorValid = false
|
||||
separatorValid = false
|
||||
else: # Invalid character
|
||||
raise newException(ValueError,
|
||||
"Invalid IP Address. Address contains an invalid character")
|
||||
|
||||
if byteCount != 3 or not seperatorValid:
|
||||
if byteCount != 3 or not separatorValid:
|
||||
raise newException(ValueError, "Invalid IP Address")
|
||||
result.address_v6[groupCount*2 + byteCount] = cast[uint8](currentShort)
|
||||
groupCount += 2
|
||||
|
||||
@@ -253,7 +253,7 @@ suite "ttimes":
|
||||
parseTestExcp("+1", "mm")
|
||||
parseTestExcp("+1", "ss")
|
||||
|
||||
test "_ as a seperator":
|
||||
test "_ as a separator":
|
||||
discard parse("2000_01_01", "YYYY'_'MM'_'dd")
|
||||
|
||||
test "dynamic timezone":
|
||||
|
||||
Reference in New Issue
Block a user