SPEC change: ^ is right-assoc and of highest priority

This commit is contained in:
Araq 2011-01-10 21:28:48 +01:00
commit 19fbc8a55e
4 changed files with 38 additions and 26 deletions

View file

@ -368,19 +368,20 @@ indentation tokens is already described in the `Lexical Analysis`_ section.
Nimrod allows user-definable operators.
Binary operators have 8 different levels of precedence. For user-defined
operators, the precedence depends on the first character the operator consists
of. All binary operators are left-associative.
of. All binary operators are left-associative, except binary operator starting
with (or only consisting of) ``^``.
================ ============================================== ================== ===============
Precedence level Operators First characters Terminal symbol
================ ============================================== ================== ===============
7 (highest) ``$`` OP7
7 (highest) ``$ ^`` OP7
6 ``* / div mod shl shr %`` ``* % \ /`` OP6
5 ``+ -`` ``+ ~ |`` OP5
4 ``&`` ``&`` OP4
3 ``== <= < >= > != in not_in is isnot`` ``= < > !`` OP3
2 ``and`` OP2
1 ``or xor`` OP1
0 (lowest) ``? @ ^ ` : .`` OP0
0 (lowest) ``? @ ` : .`` OP0
================ ============================================== ================== ===============
@ -1530,6 +1531,7 @@ Example:
close(f)
The statements after the `try`:idx: are executed in sequential order unless
an exception ``e`` is raised. If the exception type of ``e`` matches any
of the list ``exceptlist`` the corresponding statements are executed.