diff options
Diffstat (limited to 'doc/manual.txt')
-rwxr-xr-x | doc/manual.txt | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/doc/manual.txt b/doc/manual.txt index 98a8d7122..5359dfc57 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -388,37 +388,37 @@ indentation tokens is already described in the `Lexical Analysis`_ section. Nimrod allows user-definable operators. Binary operators have 10 different levels of precedence. - -Relevant character ------------------- - + +Relevant character +------------------ + An operator symbol's *relevant character* is its first character unless the first character is ``\`` and its length is greater than 1 -then it is the second character. - -This rule allows to escape operator symbols with ``\`` and keeps the operator's -precedence and associativity; this is useful for meta programming. - - -Associativity -------------- - -All binary operators are left-associative, except binary operators whose +then it is the second character. + +This rule allows to escape operator symbols with ``\`` and keeps the operator's +precedence and associativity; this is useful for meta programming. + + +Associativity +------------- + +All binary operators are left-associative, except binary operators whose relevant char is ``^``. - -Precedence ----------- + +Precedence +---------- For operators that are not keywords the precedence is determined by the following rules: If the operator ends with ``=`` and its relevant character is none of ``<``, ``>``, ``!``, ``=``, ``~``, ``?``, it is an *assignment operator* which -has the lowest precedence. - -If the operator's relevant character is ``@`` it is a `sigil-like`:idx: -operator which binds stronger than a ``primarySuffix``: ``@x.abc`` is parsed -as ``(@x).abc`` whereas ``$x.abc`` is parsed as ``$(x.abc)``. +has the lowest precedence. + +If the operator's relevant character is ``@`` it is a `sigil-like`:idx: +operator which binds stronger than a ``primarySuffix``: ``@x.abc`` is parsed +as ``(@x).abc`` whereas ``$x.abc`` is parsed as ``$(x.abc)``. Otherwise precedence is determined by the relevant character. @@ -1879,6 +1879,15 @@ handled, it is propagated through the call stack. This means that often the rest of the procedure - that is not within a ``finally`` clause - is not executed (if an exception occurs). +`except`:idx: and `finally`:idx: can also be used as a stand-alone statements. +Any statements following them in the current block will be considered to be +in an implicit try block: + +.. code-block:: nimrod + var f = fopen("numbers.txt", "r") + finally: fcsole(f) + ... + Return statement ~~~~~~~~~~~~~~~~ |