Merge branch 'devel' of github.com:Araq/Nimrod into devel

This commit is contained in:
Zahary Karadjov 2014-03-11 00:59:35 +02:00
commit 9b5357da5a
4 changed files with 113 additions and 46 deletions

View file

@ -79,8 +79,21 @@ program execution. Unless explicitly classified, an error is a static error.
A `checked runtime error`:idx: is an error that the implementation detects A `checked runtime error`:idx: is an error that the implementation detects
and reports at runtime. The method for reporting such errors is via *raising and reports at runtime. The method for reporting such errors is via *raising
exceptions*. However, the implementation provides a means to disable these exceptions* or *dying with a fatal error*. However, the implementation
runtime checks. See the section pragmas_ for details. provides a means to disable these runtime checks. See the section pragmas_
for details.
Wether a checked runtime error results in an exception or in a fatal error at
runtime is implementation specific. Thus the following program is always
invalid:
.. code-block:: nimrod
var a: array[0..1, char]
let i = 5
try:
a[i] = 'N'
except EInvalidIndex:
echo "invalid index"
An `unchecked runtime error`:idx: is an error that is not guaranteed to be An `unchecked runtime error`:idx: is an error that is not guaranteed to be
detected, and can cause the subsequent behavior of the computation to detected, and can cause the subsequent behavior of the computation to
@ -522,7 +535,7 @@ Strong spaces
The number of spaces preceeding a non-keyword operator affects precedence The number of spaces preceeding a non-keyword operator affects precedence
if the experimental parser directive ``#!strongSpaces`` is used. Indentation if the experimental parser directive ``#!strongSpaces`` is used. Indentation
is not used to determine the number of spaces. If 2 or more operators have the is not used to determine the number of spaces. If 2 or more operators have the
same number of preceeding spaces the precedence table applies, so ``1 + 3 * 4`` same number of preceding spaces the precedence table applies, so ``1 + 3 * 4``
is still parsed as ``1 + (3 * 4)``, but ``1+3 * 4`` is parsed as ``(1+3) * 4``: is still parsed as ``1 + (3 * 4)``, but ``1+3 * 4`` is parsed as ``(1+3) * 4``:
.. code-block:: nimrod .. code-block:: nimrod
@ -3487,7 +3500,7 @@ Declarative type classes are written in the following form:
c.len is ordinal c.len is ordinal
items(c) is iterator items(c) is iterator
for value in c: for value in c:
value.type is T type(value) is T
The type class will be matched if: The type class will be matched if:

View file

@ -606,6 +606,7 @@ elif not defined(useNimRtl):
optionPoParentStreams: bool optionPoParentStreams: bool
optionPoStdErrToStdOut: bool optionPoStdErrToStdOut: bool
when not defined(useFork):
proc startProcessAuxSpawn(data: TStartProcessData): TPid {.tags: [FExecIO, FReadEnv].} proc startProcessAuxSpawn(data: TStartProcessData): TPid {.tags: [FExecIO, FReadEnv].}
proc startProcessAuxFork(data: TStartProcessData): TPid {.tags: [FExecIO, FReadEnv].} proc startProcessAuxFork(data: TStartProcessData): TPid {.tags: [FExecIO, FReadEnv].}
{.push stacktrace: off, profiler: off.} {.push stacktrace: off, profiler: off.}
@ -664,7 +665,8 @@ elif not defined(useNimRtl):
data.workingDir = workingDir data.workingDir = workingDir
when defined(posix_spawn) and not defined(useFork) and not defined(useClone) and not defined(linux): when defined(posix_spawn) and not defined(useFork) and
not defined(useClone) and not defined(linux):
pid = startProcessAuxSpawn(data) pid = startProcessAuxSpawn(data)
else: else:
pid = startProcessAuxFork(data) pid = startProcessAuxFork(data)
@ -694,6 +696,7 @@ elif not defined(useNimRtl):
discard close(pStdin[readIdx]) discard close(pStdin[readIdx])
discard close(pStdout[writeIdx]) discard close(pStdout[writeIdx])
when not defined(useFork):
proc startProcessAuxSpawn(data: TStartProcessData): TPid = proc startProcessAuxSpawn(data: TStartProcessData): TPid =
var attr: Tposix_spawnattr var attr: Tposix_spawnattr
var fops: Tposix_spawn_file_actions var fops: Tposix_spawn_file_actions

View file

@ -0,0 +1,52 @@
#! strongSpaces
discard """
output: '''35
77
(Field0: 1, Field1: 2, Field2: 2)
ha
true
tester args
all
all args
'''
"""
echo 2+5 * 5
let foo = 77
echo $foo
echo (1, 2, 2)
template `&`(a, b: int): expr = a and b
template `|`(a, b: int): expr = a - b
template `++`(a, b: int): expr = a + b == 8009
when true:
let b = 66
let c = 90
let bar = 8000
if foo+4 * 4 == 8 and b&c | 9 ++
bar:
echo "ho"
else:
echo "ha"
let booA = foo+4 * 4 - b&c | 9 +
bar
# is parsed as
let booB = ((foo+4)*4) - ((b&c) | 9) + bar
echo booA == booB
template `|`(a, b): expr = (if a.len > 0: a else: b)
const
tester = "tester"
args = "args"
echo tester & " " & args|"all"
echo "all" | tester & " " & args
echo "all"|tester & " " & args

View file

@ -1,7 +1,6 @@
version 0.9.4 version 0.9.4
============= =============
- make testament produce full JSON information
- fix gensym capture bug - fix gensym capture bug
- vm - vm
- at least try to get the basic type zoo ops right - at least try to get the basic type zoo ops right