Misc documentation fixes

This commit is contained in:
Simon Ruderich 2016-09-17 15:52:36 +02:00
commit a9e796e001
9 changed files with 27 additions and 27 deletions

View file

@ -28,7 +28,7 @@ The parser uses a stack of indentation levels: the stack consists of integers
counting the spaces. The indentation information is queried at strategic counting the spaces. The indentation information is queried at strategic
places in the parser but ignored otherwise: The pseudo terminal ``IND{>}`` places in the parser but ignored otherwise: The pseudo terminal ``IND{>}``
denotes an indentation that consists of more spaces than the entry at the top denotes an indentation that consists of more spaces than the entry at the top
of the stack; IND{=} an indentation that has the same number of spaces. ``DED`` of the stack; ``IND{=}`` an indentation that has the same number of spaces. ``DED``
is another pseudo terminal that describes the *action* of popping a value is another pseudo terminal that describes the *action* of popping a value
from the stack, ``IND{>}`` then implies to push onto the stack. from the stack, ``IND{>}`` then implies to push onto the stack.
@ -399,7 +399,7 @@ These keywords are also operators:
`=`:tok:, `:`:tok:, `::`:tok: are not available as general operators; they `=`:tok:, `:`:tok:, `::`:tok: are not available as general operators; they
are used for other notational purposes. are used for other notational purposes.
``*:`` is as a special case the two tokens `*`:tok: and `:`:tok: ``*:`` is as a special case treated as the two tokens `*`:tok: and `:`:tok:
(to support ``var v*: T``). (to support ``var v*: T``).

View file

@ -68,7 +68,7 @@ Calling a procedure can be done in many different ways:
# call with named arguments (order is not relevant): # call with named arguments (order is not relevant):
callme(c='\t', y=1, x=0) # (x=0, y=1, s="", c='\t', b=false) callme(c='\t', y=1, x=0) # (x=0, y=1, s="", c='\t', b=false)
# call as a command statement: no () needed: # call as a command statement: no () needed:
callme 0, 1, "abc", '\t' callme 0, 1, "abc", '\t' # (x=0, y=1, s="abc", c='\t', b=false)
A procedure may call itself recursively. A procedure may call itself recursively.

View file

@ -462,10 +462,10 @@ While statement
Example: Example:
.. code-block:: nim .. code-block:: nim
echo "Please tell me your password: \n" echo "Please tell me your password:"
var pw = readLine(stdin) var pw = readLine(stdin)
while pw != "12345": while pw != "12345":
echo "Wrong password! Next try: \n" echo "Wrong password! Next try:"
pw = readLine(stdin) pw = readLine(stdin)

View file

@ -62,7 +62,8 @@ Precedence level Operators First charact
================ =============================================== ================== =============== ================ =============================================== ================== ===============
Whether an operator is used a prefix operator is also affected by preceeding whitespace (this parsing change was introduced with version 0.13.0): Whether an operator is used a prefix operator is also affected by preceding
whitespace (this parsing change was introduced with version 0.13.0):
.. code-block:: nim .. code-block:: nim
echo $foo echo $foo

View file

@ -406,11 +406,11 @@ builtin can be used for that:
macro debug(n: varargs[typed]): untyped = macro debug(n: varargs[typed]): untyped =
result = newNimNode(nnkStmtList, n) result = newNimNode(nnkStmtList, n)
for i in 0..n.len-1: for x in n:
# we can bind symbols in scope via 'bindSym': # we can bind symbols in scope via 'bindSym':
add(result, newCall(bindSym"write", bindSym"stdout", toStrLit(n[i]))) add(result, newCall(bindSym"write", bindSym"stdout", toStrLit(x)))
add(result, newCall(bindSym"write", bindSym"stdout", newStrLitNode(": "))) add(result, newCall(bindSym"write", bindSym"stdout", newStrLitNode(": ")))
add(result, newCall(bindSym"writeLine", bindSym"stdout", n[i])) add(result, newCall(bindSym"writeLine", bindSym"stdout", x))
var var
a: array [0..10, int] a: array [0..10, int]

View file

@ -227,8 +227,8 @@ floating pointer values at compile time; this means expressions like
Boolean type Boolean type
------------ ------------
The boolean type is named `bool`:idx: in Nim and can be one of the two The boolean type is named `bool`:idx: in Nim and can be one of the two
pre-defined values ``true`` and ``false``. Conditions in while, pre-defined values ``true`` and ``false``. Conditions in ``while``,
if, elif, when statements need to be of type bool. ``if``, ``elif``, ``when``-statements need to be of type ``bool``.
This condition holds:: This condition holds::
@ -1262,4 +1262,4 @@ Is the same as:
However later versions of the language might change this to mean "infer the However later versions of the language might change this to mean "infer the
parameters' types from the body". Then the above ``foo`` would be rejected as parameters' types from the body". Then the above ``foo`` would be rejected as
the parameters' types can not be infered from an empty ``discard`` statement. the parameters' types can not be inferred from an empty ``discard`` statement.

View file

@ -1,5 +1,5 @@
The set type models the mathematical notion of a set. The set's The set type models the mathematical notion of a set. The set's basetype can
basetype can only be an ordinal type of a certain size, namely: only be an ordinal type of a certain size, namely:
* ``int8``-``int16`` * ``int8``-``int16``
* ``uint8``/``byte``-``uint16`` * ``uint8``/``byte``-``uint16``
* ``char`` * ``char``

View file

@ -1521,7 +1521,7 @@ type # these work for most platforms:
## This is the same as the type ``double`` in *C*. ## This is the same as the type ``double`` in *C*.
clongdouble* {.importc: "long double", nodecl.} = BiggestFloat clongdouble* {.importc: "long double", nodecl.} = BiggestFloat
## This is the same as the type ``long double`` in *C*. ## This is the same as the type ``long double`` in *C*.
## This C type is not supported by Nim's code generator ## This C type is not supported by Nim's code generator.
cuchar* {.importc: "unsigned char", nodecl.} = char cuchar* {.importc: "unsigned char", nodecl.} = char
## This is the same as the type ``unsigned char`` in *C*. ## This is the same as the type ``unsigned char`` in *C*.
@ -2653,12 +2653,11 @@ when not defined(JS): #and not defined(nimscript):
when defined(nimscript): when defined(nimscript):
proc readFile*(filename: string): string {.tags: [ReadIOEffect], benign.} proc readFile*(filename: string): string {.tags: [ReadIOEffect], benign.}
## Opens a file named `filename` for reading. ## Opens a file named `filename` for reading, calls `readAll
## ## <#readAll>`_ and closes the file afterwards. Returns the string.
## Then calls `readAll <#readAll>`_ and closes the file afterwards. ## Raises an IO exception in case of an error. If # you need to call
## Returns the string. Raises an IO exception in case of an error. If ## this inside a compile time macro you can use `staticRead
## you need to call this inside a compile time macro you can use ## <#staticRead>`_.
## `staticRead <#staticRead>`_.
proc writeFile*(filename, content: string) {.tags: [WriteIOEffect], benign.} proc writeFile*(filename, content: string) {.tags: [WriteIOEffect], benign.}
## Opens a file named `filename` for writing. Then writes the ## Opens a file named `filename` for writing. Then writes the