You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -60,7 +25,7 @@ Elixir provides the following built-in operators:
60
25
*[`|>`](`|>/2`) - pipeline
61
26
*[`=~`](`=~/2`) - text-based match
62
27
63
-
Many of those can be used in guards; consult the [list of allowed guard functions and operators](patterns-and-guards.md#list-of-allowed-functions-and-operators).
28
+
Many of those can be used in guards. Consult the [list of allowed guard functions and operators](patterns-and-guards.md#list-of-allowed-functions-and-operators).
64
29
65
30
Additionally, there are a few other operators that Elixir parses but doesn't actually use.
66
31
See [Custom and overridden operators](#custom-and-overridden-operators) below for a list and for guidelines about their use.
@@ -73,7 +38,7 @@ Some other operators are special forms and cannot be overridden:
73
38
*[`&`](`&/1`) - capture operator
74
39
*[`::`](`::/2`) - type operator
75
40
76
-
Finally, these operators appear in the precedence table above but are only meaningful within certain constructs:
41
+
Finally, these operators appear in the precedence table below but are only meaningful within certain constructs:
77
42
78
43
*`=>` - see [`%{}`](`%{}/1`)
79
44
*`when` - see [Guards](patterns-and-guards.md#guards)
@@ -104,9 +69,47 @@ false
104
69
105
70
[`!=`](`!=/2`) and [`!==`](`!==/2`) act as the negation of [`==`](`==/2`) and [`===`](`===/2`), respectively.
106
71
107
-
## Custom and overridden operators
108
72
109
-
### Defining custom operators
73
+
## Operator precedence and associativity
74
+
75
+
The following is a list of all operators that Elixir is capable of parsing, ordered from higher to lower precedence, alongside their associativity:
> Elixir parses `not left in right` as `not(left in right)` and `!left in right` as `!(left in right)`, which mismatches the precedence table above, but such behaviour is deprecated and emits a warning. Both constructs must be written as `left not in right` instead. In future major versions, the parser will match the table above.
111
+
112
+
## Custom and overridden operators
110
113
111
114
Elixir is capable of parsing a predefined set of operators. It's not possible to define new operators (as supported by some languages). However, not all operators that Elixir can parse are *used* by Elixir: for example, `+` and `||` are used by Elixir for addition and boolean *or*, but `<~>` is not used (but valid).
return_error(Location, "the range step operator (//) must immediately follow the range definition operator (..), for example: 1..9//2. If you wanted to define a default argument, use (\\\\) instead. Syntax error before: ", "'//'")
0 commit comments