Merge pull request #2968 from def-/neutral-language

Neutral language
This commit is contained in:
reactormonk 2015-06-21 14:36:55 -05:00
commit 37677636bc
4 changed files with 12 additions and 12 deletions

View file

@ -107,7 +107,7 @@ Unchecked pragma
---------------- ----------------
The ``unchecked`` pragma can be used to mark a named array as ``unchecked`` The ``unchecked`` pragma can be used to mark a named array as ``unchecked``
meaning its bounds are not checked. This is often useful when one wishes to meaning its bounds are not checked. This is often useful when one wishes to
implement his own flexibly sized arrays. Additionally an unchecked array is implement their own flexibly sized arrays. Additionally an unchecked array is
translated into a C array of undetermined size: translated into a C array of undetermined size:
.. code-block:: nim .. code-block:: nim

View file

@ -333,8 +333,8 @@ The while statement is a simple looping construct:
name = readLine(stdin) name = readLine(stdin)
# no ``var``, because we do not declare a new variable here # no ``var``, because we do not declare a new variable here
The example uses a while loop to keep asking the user for his name, as long as The example uses a while loop to keep asking the user for their name, as long
he types in nothing (only presses RETURN). as the user types in nothing (only presses RETURN).
For statement For statement
@ -545,9 +545,9 @@ procedures are defined with the ``proc`` keyword:
echo("I think you know what the problem is just as well as I do.") echo("I think you know what the problem is just as well as I do.")
This example shows a procedure named ``yes`` that asks the user a ``question`` This example shows a procedure named ``yes`` that asks the user a ``question``
and returns true if he answered "yes" (or something similar) and returns and returns true if they answered "yes" (or something similar) and returns
false if he answered "no" (or something similar). A ``return`` statement leaves false if they answered "no" (or something similar). A ``return`` statement
the procedure (and therefore the while loop) immediately. The leaves the procedure (and therefore the while loop) immediately. The
``(question: string): bool`` syntax describes that the procedure expects a ``(question: string): bool`` syntax describes that the procedure expects a
parameter named ``question`` of type ``string`` and returns a value of type parameter named ``question`` of type ``string`` and returns a value of type
``bool``. ``Bool`` is a built-in type: the only valid values for ``bool`` are ``bool``. ``Bool`` is a built-in type: the only valid values for ``bool`` are

View file

@ -210,7 +210,7 @@ proc getMaxMem(a: var MemRegion): int =
proc llAlloc(a: var MemRegion, size: int): pointer = proc llAlloc(a: var MemRegion, size: int): pointer =
# *low-level* alloc for the memory managers data structures. Deallocation # *low-level* alloc for the memory managers data structures. Deallocation
# is done at he end of the allocator's life time. # is done at the end of the allocator's life time.
if a.llmem == nil or size > a.llmem.size: if a.llmem == nil or size > a.llmem.size:
# the requested size is ``roundup(size+sizeof(LLChunk), PageSize)``, but # the requested size is ``roundup(size+sizeof(LLChunk), PageSize)``, but
# since we know ``size`` is a (small) constant, we know the requested size # since we know ``size`` is a (small) constant, we know the requested size

View file

@ -7,14 +7,14 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
when declared(NimString): when declared(NimString):
# we are in system module: # we are in system module:
{.pragma: codegenType, compilerproc.} {.pragma: codegenType, compilerproc.}
else: else:
{.pragma: codegenType, importc.} {.pragma: codegenType, importc.}
type type
# This should be he same as ast.TTypeKind # This should be the same as ast.TTypeKind
# many enum fields are not used at runtime # many enum fields are not used at runtime
TNimKind = enum TNimKind = enum
tyNone, tyNone,
@ -73,7 +73,7 @@ type
len: int len: int
sons: ptr array [0..0x7fff, ptr TNimNode] sons: ptr array [0..0x7fff, ptr TNimNode]
TNimTypeFlag = enum TNimTypeFlag = enum
ntfNoRefs = 0, # type contains no tyRef, tySequence, tyString ntfNoRefs = 0, # type contains no tyRef, tySequence, tyString
ntfAcyclic = 1, # type cannot form a cycle ntfAcyclic = 1, # type cannot form a cycle
ntfEnumHole = 2 # enum has holes and thus `$` for them needs the slow ntfEnumHole = 2 # enum has holes and thus `$` for them needs the slow
@ -88,5 +88,5 @@ type
marker: proc (p: pointer, op: int) {.nimcall, benign.} # marker proc for GC marker: proc (p: pointer, op: int) {.nimcall, benign.} # marker proc for GC
deepcopy: proc (p: pointer): pointer {.nimcall, benign.} deepcopy: proc (p: pointer): pointer {.nimcall, benign.}
PNimType = ptr TNimType PNimType = ptr TNimType
# node.len may be the ``first`` element of a set # node.len may be the ``first`` element of a set