Difference between revisions of "Operator precedence"
Klickverbot (talk | contribs) m (Klickverbot moved page DWiki:Operator precedence to Operator precedence: The DWiki namespace is for meta-content about DWiki itself.) |
m (Mark highest/lowest operator precedence) |
||
Line 3: | Line 3: | ||
! Priority || Description || Operators || Comments | ! Priority || Description || Operators || Comments | ||
|- | |- | ||
− | | 15 | + | | 15 |
+ | highest | ||
+ | || Template instantiation || ! || Top-level ',' in rhs expression treated specially. Cannot be chained | ||
|- | |- | ||
| 14.5 || Lambda abstraction || => || Not a real operator, occurs twice, this is binding power to the left. | | 14.5 || Lambda abstraction || => || Not a real operator, occurs twice, this is binding power to the left. | ||
Line 39: | Line 41: | ||
| 1 || Comma operator || , || Not to be confused with other uses of ',', though their precedence is the same | | 1 || Comma operator || , || Not to be confused with other uses of ',', though their precedence is the same | ||
|- | |- | ||
− | | 0 || Range separator || .. || Not a real operator, hardwired into syntax at specific points | + | | 0 |
+ | lowest | ||
+ | || Range separator || .. || Not a real operator, hardwired into syntax at specific points | ||
|} | |} |
Revision as of 19:30, 2 January 2014
Priority | Description | Operators | Comments | |
---|---|---|---|---|
15
highest |
Template instantiation | ! | Top-level ',' in rhs expression treated specially. Cannot be chained | |
14.5 | Lambda abstraction | => | Not a real operator, occurs twice, this is binding power to the left. | |
14 | Postfix operators | . ++ -- ( [ | ( and [ treat top-level ',' in rhs expression specially and require balanced ) or ] in order to be completed | |
13 | Power operator | ^^ | Right-associative | |
12 | Unary operators | & ++ -- * + - ! ~ | ||
11 | - | * / % | ||
10 | - | + - ~ | Binary '~' is the concatenation operator | |
9 | Bit shift operators | << >> >>> | ||
6a | Comparison operators | == != > < >= <= !> !< !>= !<= <> !<> <>= !<>= in !in is !is | Unordered with respect to bitwise operators, cannot be chained. | |
8b | Bitwise AND | & | Unordered with respect to comparison operators | |
7b | Bitwise XOR | ^ | Unordered with respect to comparison operators | |
6b | Bitwise OR | | | Unordered with respect to comparison operators | |
5 | Logical AND | && | Short-circuit | |
4 | Logical OR | || | Short-circuit | |
3 | Conditional operator | ?: | Right-associative | |
2 | Assignment operators | = -= += <<= >>= >>>= = *= %= ^= ^^= ~= | Right-associative | |
1.5 | Lambda abstraction | => | Not a real operator, occurs twice, this is binding power to the right | |
1 | Comma operator | , | Not to be confused with other uses of ',', though their precedence is the same | |
0
lowest |
Range separator | .. | Not a real operator, hardwired into syntax at specific points |