Merge branch 'devel' of github.com:nim-lang/Nim into devel
This commit is contained in:
commit
4bd901d3e1
15 changed files with 21 additions and 21 deletions
|
|
@ -463,7 +463,7 @@ type
|
||||||
tfNotNil, # type cannot be 'nil'
|
tfNotNil, # type cannot be 'nil'
|
||||||
|
|
||||||
tfNeedsInit, # type constains a "not nil" constraint somewhere or some
|
tfNeedsInit, # type constains a "not nil" constraint somewhere or some
|
||||||
# other type so that it requires initalization
|
# other type so that it requires initialization
|
||||||
tfVarIsPtr, # 'var' type is translated like 'ptr' even in C++ mode
|
tfVarIsPtr, # 'var' type is translated like 'ptr' even in C++ mode
|
||||||
tfHasMeta, # type contains "wildcard" sub-types such as generic params
|
tfHasMeta, # type contains "wildcard" sub-types such as generic params
|
||||||
# or other type classes
|
# or other type classes
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) =
|
||||||
return
|
return
|
||||||
# we need no surrounding [] here because the type is in a line of its own
|
# we need no surrounding [] here because the type is in a line of its own
|
||||||
if t.kind == tyForward: internalError("encodeType: tyForward")
|
if t.kind == tyForward: internalError("encodeType: tyForward")
|
||||||
# for the new rodfile viewer we use a preceeding [ so that the data section
|
# for the new rodfile viewer we use a preceding [ so that the data section
|
||||||
# can easily be disambiguated:
|
# can easily be disambiguated:
|
||||||
add(result, '[')
|
add(result, '[')
|
||||||
encodeVInt(ord(t.kind), result)
|
encodeVInt(ord(t.kind), result)
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ proc newSymG*(kind: TSymKind, n: PNode, c: PContext): PSym =
|
||||||
|
|
||||||
proc semIdentVis(c: PContext, kind: TSymKind, n: PNode,
|
proc semIdentVis(c: PContext, kind: TSymKind, n: PNode,
|
||||||
allowed: TSymFlags): PSym
|
allowed: TSymFlags): PSym
|
||||||
# identifier with visability
|
# identifier with visibility
|
||||||
proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode,
|
proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode,
|
||||||
allowed: TSymFlags): PSym
|
allowed: TSymFlags): PSym
|
||||||
proc semStmtScope(c: PContext, n: PNode): PNode
|
proc semStmtScope(c: PContext, n: PNode): PNode
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#
|
#
|
||||||
# * inlines iterators
|
# * inlines iterators
|
||||||
# * inlines constants
|
# * inlines constants
|
||||||
# * performes constant folding
|
# * performs constant folding
|
||||||
# * converts "continue" to "break"; disambiguates "break"
|
# * converts "continue" to "break"; disambiguates "break"
|
||||||
# * introduces method dispatchers
|
# * introduces method dispatchers
|
||||||
# * performs lambda lifting for closure support
|
# * performs lambda lifting for closure support
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# Nim's Runtime Library
|
# Nim's Runtime Library
|
||||||
# (c) Copyright 2015 Nim Contributers
|
# (c) Copyright 2015 Nim Contributors
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -508,7 +508,7 @@ iterator findIter*(str: string, pattern: Regex, start = 0, endpos = int.high): R
|
||||||
## Variants:
|
## Variants:
|
||||||
##
|
##
|
||||||
## - ``proc findAll(...)`` returns a ``seq[string]``
|
## - ``proc findAll(...)`` returns a ``seq[string]``
|
||||||
# see pcredemo for explaination
|
# see pcredemo for explanation
|
||||||
let matchesCrLf = pattern.matchesCrLf()
|
let matchesCrLf = pattern.matchesCrLf()
|
||||||
let unicode = uint32(getinfo[culong](pattern, pcre.INFO_OPTIONS) and
|
let unicode = uint32(getinfo[culong](pattern, pcre.INFO_OPTIONS) and
|
||||||
pcre.UTF8) > 0u32
|
pcre.UTF8) > 0u32
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ proc readIntoBuf(socket: Socket, flags: int32): int =
|
||||||
else:
|
else:
|
||||||
result = recv(socket.fd, addr(socket.buffer), cint(socket.buffer.high), flags)
|
result = recv(socket.fd, addr(socket.buffer), cint(socket.buffer.high), flags)
|
||||||
if result < 0:
|
if result < 0:
|
||||||
# Save it in case it gets reset (the Nim codegen occassionally may call
|
# Save it in case it gets reset (the Nim codegen occasionally may call
|
||||||
# Win API functions which reset it).
|
# Win API functions which reset it).
|
||||||
socket.lastError = osLastError()
|
socket.lastError = osLastError()
|
||||||
if result <= 0:
|
if result <= 0:
|
||||||
|
|
|
||||||
|
|
@ -288,19 +288,19 @@ proc rawGetTok(c: var CfgParser, tok: var Token) =
|
||||||
else: getSymbol(c, tok)
|
else: getSymbol(c, tok)
|
||||||
|
|
||||||
proc errorStr*(c: CfgParser, msg: string): string {.rtl, extern: "npc$1".} =
|
proc errorStr*(c: CfgParser, msg: string): string {.rtl, extern: "npc$1".} =
|
||||||
## returns a properly formated error message containing current line and
|
## returns a properly formatted error message containing current line and
|
||||||
## column information.
|
## column information.
|
||||||
result = `%`("$1($2, $3) Error: $4",
|
result = `%`("$1($2, $3) Error: $4",
|
||||||
[c.filename, $getLine(c), $getColumn(c), msg])
|
[c.filename, $getLine(c), $getColumn(c), msg])
|
||||||
|
|
||||||
proc warningStr*(c: CfgParser, msg: string): string {.rtl, extern: "npc$1".} =
|
proc warningStr*(c: CfgParser, msg: string): string {.rtl, extern: "npc$1".} =
|
||||||
## returns a properly formated warning message containing current line and
|
## returns a properly formatted warning message containing current line and
|
||||||
## column information.
|
## column information.
|
||||||
result = `%`("$1($2, $3) Warning: $4",
|
result = `%`("$1($2, $3) Warning: $4",
|
||||||
[c.filename, $getLine(c), $getColumn(c), msg])
|
[c.filename, $getLine(c), $getColumn(c), msg])
|
||||||
|
|
||||||
proc ignoreMsg*(c: CfgParser, e: CfgEvent): string {.rtl, extern: "npc$1".} =
|
proc ignoreMsg*(c: CfgParser, e: CfgEvent): string {.rtl, extern: "npc$1".} =
|
||||||
## returns a properly formated warning message containing that
|
## returns a properly formatted warning message containing that
|
||||||
## an entry is ignored.
|
## an entry is ignored.
|
||||||
case e.kind
|
case e.kind
|
||||||
of cfgSectionStart: result = c.warningStr("section ignored: " & e.section)
|
of cfgSectionStart: result = c.warningStr("section ignored: " & e.section)
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ proc roots*(p:Poly,tol=1.0e-9,zerotol=1.0e-6,mergetol=1.0e-12,maxiter=1000):seq[
|
||||||
## `tol` is the tolerance used to break searching for each root when reached.
|
## `tol` is the tolerance used to break searching for each root when reached.
|
||||||
## `zerotol` is the tolerance, which is 'close enough' to zero to be considered a root
|
## `zerotol` is the tolerance, which is 'close enough' to zero to be considered a root
|
||||||
## and is used to find roots for curves that only 'touch' the x-axis.
|
## and is used to find roots for curves that only 'touch' the x-axis.
|
||||||
## `mergetol` is the tolerance, of which two x-values are considered beeing the same root.
|
## `mergetol` is the tolerance, of which two x-values are considered being the same root.
|
||||||
## `maxiter` can be used to limit the number of iterations for each root.
|
## `maxiter` can be used to limit the number of iterations for each root.
|
||||||
## Returns a (possibly empty) sorted sequence with the solutions.
|
## Returns a (possibly empty) sorted sequence with the solutions.
|
||||||
var deg=p.degree
|
var deg=p.degree
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nim Compiler
|
# The Nim Compiler
|
||||||
# (c) Copyright 2015 Nim Contributers
|
# (c) Copyright 2015 Nim Contributors
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ proc readBool*(s: Stream): bool =
|
||||||
read(s, result)
|
read(s, result)
|
||||||
|
|
||||||
proc peekBool*(s: Stream): bool =
|
proc peekBool*(s: Stream): bool =
|
||||||
## peeks a bool from the stream `s`. Raises `EIO` if an error occured.
|
## peeks a bool from the stream `s`. Raises `EIO` if an error occurred.
|
||||||
peek(s, result)
|
peek(s, result)
|
||||||
|
|
||||||
proc readInt8*(s: Stream): int8 =
|
proc readInt8*(s: Stream): int8 =
|
||||||
|
|
|
||||||
|
|
@ -1245,7 +1245,7 @@ proc getDayOfWeek*(day, month, year: int): WeekDay =
|
||||||
result = (d-1).WeekDay
|
result = (d-1).WeekDay
|
||||||
|
|
||||||
proc getDayOfWeekJulian*(day, month, year: int): WeekDay =
|
proc getDayOfWeekJulian*(day, month, year: int): WeekDay =
|
||||||
## Returns the day of the week enum from day, month and year, according to the Julian calender.
|
## Returns the day of the week enum from day, month and year, according to the Julian calendar.
|
||||||
# Day & month start from one.
|
# Day & month start from one.
|
||||||
let
|
let
|
||||||
a = (14 - month) div 12
|
a = (14 - month) div 12
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ when allowForeignThreadGc:
|
||||||
## this thread will only be initialized once per thread, no matter how often
|
## this thread will only be initialized once per thread, no matter how often
|
||||||
## it is called.
|
## it is called.
|
||||||
##
|
##
|
||||||
## This function is availble only when ``--threads:on`` and ``--tlsEmulation:off``
|
## This function is available only when ``--threads:on`` and ``--tlsEmulation:off``
|
||||||
## switches are used
|
## switches are used
|
||||||
if not localGcInitialized:
|
if not localGcInitialized:
|
||||||
localGcInitialized = true
|
localGcInitialized = true
|
||||||
|
|
@ -100,7 +100,7 @@ when allowForeignThreadGc:
|
||||||
initGC()
|
initGC()
|
||||||
else:
|
else:
|
||||||
template setupForeignThreadGc*(): stmt =
|
template setupForeignThreadGc*(): stmt =
|
||||||
{.error: "setupForeignThreadGc is availble only when ``--threads:on`` and ``--tlsEmulation:off`` are used".}
|
{.error: "setupForeignThreadGc is available only when ``--threads:on`` and ``--tlsEmulation:off`` are used".}
|
||||||
|
|
||||||
# ----------------- stack management --------------------------------------
|
# ----------------- stack management --------------------------------------
|
||||||
# inspired from Smart Eiffel
|
# inspired from Smart Eiffel
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ proc getEnv*(key: string): string {.tags: [ReadIOEffect].} =
|
||||||
builtin
|
builtin
|
||||||
|
|
||||||
proc existsEnv*(key: string): bool {.tags: [ReadIOEffect].} =
|
proc existsEnv*(key: string): bool {.tags: [ReadIOEffect].} =
|
||||||
## Checks for the existance of an environment variable named `key`.
|
## Checks for the existence of an environment variable named `key`.
|
||||||
builtin
|
builtin
|
||||||
|
|
||||||
proc fileExists*(filename: string): bool {.tags: [ReadIOEffect].} =
|
proc fileExists*(filename: string): bool {.tags: [ReadIOEffect].} =
|
||||||
|
|
@ -189,7 +189,7 @@ proc get*(key: string): string =
|
||||||
builtin
|
builtin
|
||||||
|
|
||||||
proc exists*(key: string): bool =
|
proc exists*(key: string): bool =
|
||||||
## Checks for the existance of a configuration 'key'
|
## Checks for the existence of a configuration 'key'
|
||||||
## like 'gcc.options.always'.
|
## like 'gcc.options.always'.
|
||||||
builtin
|
builtin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import unittest
|
||||||
include nre
|
include nre
|
||||||
|
|
||||||
suite "Test NRE initialization":
|
suite "Test NRE initialization":
|
||||||
test "correct intialization":
|
test "correct initialization":
|
||||||
check(re("[0-9]+") != nil)
|
check(re("[0-9]+") != nil)
|
||||||
check(re("(?i)[0-9]+") != nil)
|
check(re("(?i)[0-9]+") != nil)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,7 @@ proc writeformat(o: var Writer; p: pointer; fmt: Format) =
|
||||||
## Write pointer `i` according to format `fmt` using output object
|
## Write pointer `i` according to format `fmt` using output object
|
||||||
## `o` and output function `add`.
|
## `o` and output function `add`.
|
||||||
##
|
##
|
||||||
## Pointers are casted to unsigned int and formated as hexadecimal
|
## Pointers are casted to unsigned int and formatted as hexadecimal
|
||||||
## with prefix unless specified otherwise.
|
## with prefix unless specified otherwise.
|
||||||
var f = fmt
|
var f = fmt
|
||||||
if f.typ == 0.char:
|
if f.typ == 0.char:
|
||||||
|
|
@ -584,7 +584,7 @@ proc splitfmt(s: string): seq[Part] {.compiletime, nosideeffect.} =
|
||||||
## Each part is either a literal string or a format specification. A
|
## Each part is either a literal string or a format specification. A
|
||||||
## format specification is a substring of the form
|
## format specification is a substring of the form
|
||||||
## "{[arg][:format]}" where `arg` is either empty or a number
|
## "{[arg][:format]}" where `arg` is either empty or a number
|
||||||
## refering to the arg-th argument and an additional field or array
|
## referring to the arg-th argument and an additional field or array
|
||||||
## index. The format string is a string accepted by `parse`.
|
## index. The format string is a string accepted by `parse`.
|
||||||
let subpeg = sequence(capture(digits()),
|
let subpeg = sequence(capture(digits()),
|
||||||
capture(?sequence(charSet({'.'}), *pegs.identStartChars(), *identChars())),
|
capture(?sequence(charSet({'.'}), *pegs.identStartChars(), *identChars())),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue