=====================================
unary
=====================================

@arg

+arg
-arg
!arg
^arg
not arg
~~~arg

&arg

---

(source
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier)))

=====================================
binary left associative
=====================================

a ** b ** c

a * b * c
a / b / c

a + b + c
a - b - c

a ^^^ b ^^^ c

a in b in c
a not in b not in c

a |> b |> c
a <<< b <<< c
a >>> b >>> c
a <<~ b <<~ c
a ~>> b ~>> c
a <~ b <~ c
a ~> b ~> c
a <~> b <~> c
a <|> b <|> c

a < b < c
a > b > c
a <= b <= c
a >= b >= c

a == b == c
a != b != c
a =~ b =~ c
a === b === c
a !== b !== c

a && b && c
a &&& b &&& c
a and b and c

a || b || c
a ||| b ||| c
a or b or c

a <- b <- c
a \\ b \\ c

---

(source
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier)))

=====================================
binary right associative
=====================================

a ++ b ++ c
a -- b -- c
a +++ b +++ c
a --- b --- c
a .. b .. c
a <> b <> c

a = b = c

a | b | c

a :: b :: c

a when b when c

---

(source
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier)))
  (binary_operator (identifier) (binary_operator (identifier) (identifier))))

=====================================
precedence on the same level falls back to associativity
=====================================

a * b / c
a + b - c
a in b not in c
a <<< b >>> c
a < b > c
a == b != c
a &&& b && c
a ||| b || c
a <- b \\ c

a ++ b -- c

---

(source
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (binary_operator (identifier) (identifier)) (identifier))
  (binary_operator (identifier) (binary_operator (identifier) (identifier))))

=====================================
precedence on different levels
=====================================

& @ a - b
a -- b + c
a - b ++ c
a = b <<< c

a + b * c - d
a ** b + c ** d

---

(source
  (unary_operator
    (binary_operator
      (unary_operator
        (identifier))
      (identifier)))
  (binary_operator
    (identifier)
    (binary_operator
      (identifier)
      (identifier)))
  (binary_operator
    (binary_operator
      (identifier)
      (identifier))
    (identifier))
  (binary_operator
    (identifier)
    (binary_operator
      (identifier)
      (identifier)))
  (binary_operator
    (binary_operator
      (identifier)
      (binary_operator
        (identifier)
        (identifier)))
    (identifier))
  (binary_operator
    (binary_operator
      (identifier)
      (identifier))
    (binary_operator
      (identifier)
      (identifier))))

=====================================
precedence determined by parentheses
=====================================

(& a) - b

(a + b) * (c - d)

---

(source
  (binary_operator
    (block
      (unary_operator
        (identifier)))
    (identifier))
  (binary_operator
    (block
      (binary_operator
        (identifier)
        (identifier)))
    (block
      (binary_operator
        (identifier)
        (identifier)))))

=====================================
"not in" spacing
=====================================

a not    in b

---

(source
  (binary_operator
    (identifier)
    (identifier)))

=====================================
"not in" boundary
=====================================

fun not inARG

---

(source
  (call
    (identifier)
    (arguments
      (unary_operator
        (identifier)))))

=====================================
multiline / unary
=====================================

@
arg

+
arg

-
arg

!
arg

^
arg

not
arg

~~~
arg

&
arg

---

(source
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier))
  (unary_operator (identifier)))

=====================================
multiline / binary
=====================================

a
**
b

a
*
b

a
/
b

a
++
b

a
--
b

a
+++
b

a
---
b

a
..
b

a
<>
b


a
^^^
b

a
in
b

a
not in
b

a
|>
b

a
<<<
b

a
>>>
b

a
<<~
b

a
~>>
b

a
<~
b

a
~>
b

a
<~>
b

a
<|>
b

a
<
b

a
>
b

a
<=
b

a
>=
b

a
==
b

a
!=
b

a
=~
b

a
===
b

a
!==
b

a
&&
b

a
&&&
b

a
and
b

a
||
b

a
|||
b

a
or
b

a
=
b

a
|
b

a
::
b

a
when
b

a
<-
b

a
\\
b

---

(source
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier))
  (binary_operator (identifier) (identifier)))

=====================================
multiline / unary over binary
=====================================

a
+
b

a
-
b

---

(source
  (identifier)
  (unary_operator
    (identifier))
  (identifier)
  (unary_operator
    (identifier)))

=====================================
multiline / right operands
=====================================

x
not in
[y]

x
not in[y]

:a
++:b

:a++
:b

---

(source
  (binary_operator
    (identifier)
    (list
      (identifier)))
  (binary_operator
    (identifier)
    (list
      (identifier)))
  (binary_operator
    (atom)
    (atom))
  (binary_operator
    (atom)
    (atom)))

=====================================
multiline / unary over binary (precedence)
=====================================

x
-
y

x
+
y

---

(source
  (identifier)
  (unary_operator
    (identifier))
  (identifier)
  (unary_operator
    (identifier)))

=====================================
plus minus
=====================================

x+y
x + y
x+ y

x +y
x +y +z


---

(source
  (binary_operator
    (identifier)
    (identifier))
  (binary_operator
    (identifier)
    (identifier))
  (binary_operator
    (identifier)
    (identifier))
  (call
    (identifier)
    (arguments
      (unary_operator
        (identifier))))
  (call
    (identifier)
    (arguments
      (unary_operator
        (call
          (identifier)
          (arguments
            (unary_operator
              (identifier))))))))

=====================================
stepped range
=====================================

1 .. 2 // 3
1..2//3
0..1//-1

---

(source
  (binary_operator
    (binary_operator
      (integer)
      (integer))
    (integer))
  (binary_operator
    (binary_operator
      (integer)
      (integer))
    (integer))
  (binary_operator
    (binary_operator
      (integer)
      (integer))
    (unary_operator
      (integer))))

=====================================
stepped range / multiline
=====================================

1..2
// 4

---

(source
  (binary_operator
    (binary_operator
      (integer)
      (integer))
    (integer)))

=====================================
stepped ranges / blocks
=====================================

foo do end..bar do end//baz do end
1..(2//3)
(1..2)//3
(1..2)//(3)

---

(source
  (binary_operator
    (binary_operator
      (call
        (identifier)
        (do_block))
      (call
        (identifier)
        (do_block)))
    (call
      (identifier)
      (do_block)))
  (binary_operator
    (integer)
    (block
      (binary_operator
        (integer)
        (integer))))
  (binary_operator
    (block
      (binary_operator
        (integer)
        (integer)))
    (integer))
  (binary_operator
    (block
      (binary_operator
        (integer)
        (integer)))
    (block
      (integer))))

=====================================
[field names]
=====================================

a + b
@a

---

(source
  (binary_operator
    left: (identifier)
    right: (identifier))
  (unary_operator
    operand: (identifier)))
