This commit is contained in:
Araq 2014-03-22 22:59:23 +01:00
commit b76d2eac7f
3 changed files with 14 additions and 8 deletions

View file

@ -499,18 +499,21 @@ other binary operators are left-associative.
Precedence
----------
For operators that are not keywords the precedence is determined by the
following rules:
Unary operators always bind stronger than any binary
operator: ``$a + b`` is ``($a) + b`` and not ``$(a + b)``.
If an unary 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)``.
For binary 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)``.
Otherwise precedence is determined by the relevant character.
================ =============================================== ================== ===============