mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Put the table with operator precedence in a separate file, included in both Operators and Cheatsheet
This commit is contained in:
parent
82e5339d23
commit
1ab84bb361
@ -6,8 +6,7 @@ Cheatsheet
|
|||||||
|
|
||||||
Order of Precedence of Operators
|
Order of Precedence of Operators
|
||||||
================================
|
================================
|
||||||
|
.. include:: types/operator-precedence-table.rst
|
||||||
:ref:`order`
|
|
||||||
|
|
||||||
.. index:: assert, block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, gas price, origin, revert, require, keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, codehash, send
|
.. index:: assert, block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, gas price, origin, revert, require, keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, codehash, send
|
||||||
|
|
||||||
|
57
docs/types/operator-precedence-table.rst
Normal file
57
docs/types/operator-precedence-table.rst
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
The following is the order of precedence for operators, listed in order of evaluation.
|
||||||
|
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| Precedence | Description | Operator |
|
||||||
|
+============+=====================================+============================================+
|
||||||
|
| *1* | Postfix increment and decrement | ``++``, ``--`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | New expression | ``new <typename>`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Array subscripting | ``<array>[<index>]`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Member access | ``<object>.<member>`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Function-like call | ``<func>(<args...>)`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Parentheses | ``(<statement>)`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *2* | Prefix increment and decrement | ``++``, ``--`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Unary minus | ``-`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Unary operations | ``delete`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Logical NOT | ``!`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Bitwise NOT | ``~`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *3* | Exponentiation | ``**`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *4* | Multiplication, division and modulo | ``*``, ``/``, ``%`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *5* | Addition and subtraction | ``+``, ``-`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *6* | Bitwise shift operators | ``<<``, ``>>`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *7* | Bitwise AND | ``&`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *8* | Bitwise XOR | ``^`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *9* | Bitwise OR | ``|`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *10* | Inequality operators | ``<``, ``>``, ``<=``, ``>=`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *11* | Equality operators | ``==``, ``!=`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *12* | Logical AND | ``&&`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *13* | Logical OR | ``||`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *14* | Ternary operator | ``<conditional> ? <if-true> : <if-false>`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, |
|
||||||
|
| | | ``>>=``, ``+=``, ``-=``, ``*=``, ``/=``, |
|
||||||
|
| | | ``%=`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
|
| *15* | Comma operator | ``,`` |
|
||||||
|
+------------+-------------------------------------+--------------------------------------------+
|
@ -115,60 +115,4 @@ value it referred to previously.
|
|||||||
Order of Precedence of Operators
|
Order of Precedence of Operators
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
The following is the order of precedence for operators, listed in order of evaluation.
|
.. include:: types/operator-precedence-table.rst
|
||||||
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| Precedence | Description | Operator |
|
|
||||||
+============+=====================================+============================================+
|
|
||||||
| *1* | Postfix increment and decrement | ``++``, ``--`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | New expression | ``new <typename>`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Array subscripting | ``<array>[<index>]`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Member access | ``<object>.<member>`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Function-like call | ``<func>(<args...>)`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Parentheses | ``(<statement>)`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *2* | Prefix increment and decrement | ``++``, ``--`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Unary minus | ``-`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Unary operations | ``delete`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Logical NOT | ``!`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Bitwise NOT | ``~`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *3* | Exponentiation | ``**`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *4* | Multiplication, division and modulo | ``*``, ``/``, ``%`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *5* | Addition and subtraction | ``+``, ``-`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *6* | Bitwise shift operators | ``<<``, ``>>`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *7* | Bitwise AND | ``&`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *8* | Bitwise XOR | ``^`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *9* | Bitwise OR | ``|`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *10* | Inequality operators | ``<``, ``>``, ``<=``, ``>=`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *11* | Equality operators | ``==``, ``!=`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *12* | Logical AND | ``&&`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *13* | Logical OR | ``||`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *14* | Ternary operator | ``<conditional> ? <if-true> : <if-false>`` |
|
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
|
||||||
| | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, |
|
|
||||||
| | | ``>>=``, ``+=``, ``-=``, ``*=``, ``/=``, |
|
|
||||||
| | | ``%=`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
| *15* | Comma operator | ``,`` |
|
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
|
||||||
|
Loading…
Reference in New Issue
Block a user