Skip to content

Commit

Permalink
Document operator precedence.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Sep 30, 2019
1 parent 75ec48b commit 685cecf
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/writingrules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,54 @@ in the file.
($a or $b) and ($c or $d)
}
The following table lists the precedence and associativity of all operators. The
table is sorted in descending precedence order, which means that operators listed
on a higher row in the list are grouped prior operators listed in rows further
below it. Operators within the same row have the same precedence, if they appear
together in a expression the associativity determines how they are grouped.

========== ======== ========================================= =============
Precedence Operator Description Associativity
========== ======== ========================================= =============
1 [] Array subscripting Left-to-right
. Structure member access
---------- -------- ----------------------------------------- -------------
2 - Unary minus Right-to-left
~ Bitwise not
---------- -------- ----------------------------------------- -------------
3 * Multiplication Left-to-right
\ Division
% Remainder
---------- -------- ----------------------------------------- -------------
4 + Addition Left-to-right
- Substraction
---------- -------- ----------------------------------------- -------------
5 << Bitwise left shift Left-to-right
>> Bitwise right shift
---------- -------- ----------------------------------------- -------------
6 & Bitwise and Left-to-right
---------- -------- ----------------------------------------- -------------
7 ^ Bitwise xor Left-to-right
---------- -------- ----------------------------------------- -------------
8 | Bitwise or Left-to-right
---------- -------- ----------------------------------------- -------------
9 < Less than Left-to-right
<= Less than or equal to
> Greater than
>= Greater than or equal to
---------- -------- ----------------------------------------- -------------
10 == Equal to Left-to-right
!= Not equal to
---------- -------- ----------------------------------------- -------------
11 not Logical not Right-to-left
---------- -------- ----------------------------------------- -------------
12 and Logical and Left-to-right
---------- -------- ----------------------------------------- -------------
13 or Logical or Left-to-right
========== ======== ========================================= =============


Counting strings
----------------

Expand Down

0 comments on commit 685cecf

Please sign in to comment.