tree-sitter-elixir/test/corpus/expression/operator.txt

761 lines
13 KiB
Plaintext
Raw Normal View History

2021-09-01 14:59:04 +00:00
=====================================
unary
=====================================
@arg
+arg
-arg
!arg
^arg
not arg
~~~arg
&arg
---
(source
2021-09-25 00:23:37 +00:00
(unary_operator (identifier))
(unary_operator (identifier))
(unary_operator (identifier))
(unary_operator (identifier))
(unary_operator (identifier))
(unary_operator (identifier))
(unary_operator (identifier))
(unary_operator (identifier)))
2021-09-01 14:59:04 +00:00
=====================================
binary left associative
=====================================
2021-09-25 00:23:37 +00:00
a ** b ** c
2021-09-01 14:59:04 +00:00
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))
2021-09-25 00:23:37 +00:00
(binary_operator (binary_operator (identifier) (identifier)) (identifier))
2021-09-01 14:59:04 +00:00
(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
2021-09-25 00:23:37 +00:00
a ** b + c ** d
2021-09-01 14:59:04 +00:00
---
(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)))
2021-09-25 00:23:37 +00:00
(identifier))
(binary_operator
(binary_operator
(identifier)
(identifier))
(binary_operator
(identifier)
(identifier))))
2021-09-01 14:59:04 +00:00
=====================================
precedence determined by parentheses
=====================================
(& a) - b
(a + b) * (c - d)
---
(source
(binary_operator
2021-09-25 00:23:37 +00:00
(block
(unary_operator
(identifier)))
2021-09-01 14:59:04 +00:00
(identifier))
(binary_operator
(block
(binary_operator
(identifier)
(identifier)))
(block
(binary_operator
(identifier)
(identifier)))))
=====================================
2021-09-25 00:23:37 +00:00
"not in" spacing
2021-09-01 14:59:04 +00:00
=====================================
2021-09-25 00:23:37 +00:00
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
2021-09-01 14:59:04 +00:00
-
2021-09-25 00:23:37 +00:00
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
=====================================
2021-09-01 14:59:04 +00:00
x
not in
[y]
2021-09-25 00:23:37 +00:00
x
not in[y]
:a
++:b
:a++
:b
---
(source
(binary_operator
(identifier)
(list
(identifier)))
(binary_operator
(identifier)
(list
(identifier)))
(binary_operator
2021-09-28 14:00:35 +00:00
(atom)
(atom))
2021-09-25 00:23:37 +00:00
(binary_operator
2021-09-28 14:00:35 +00:00
(atom)
(atom)))
2021-09-25 00:23:37 +00:00
=====================================
multiline / unary over binary (precedence)
=====================================
x
-
y
x
+
y
2021-09-01 14:59:04 +00:00
---
(source
2021-09-25 00:23:37 +00:00
(identifier)
(unary_operator
(identifier))
(identifier)
2021-09-01 14:59:04 +00:00
(unary_operator
2021-09-25 00:23:37 +00:00
(identifier)))
=====================================
plus minus
=====================================
x+y
x + y
x+ y
x +y
x +y +z
---
(source
(binary_operator
(identifier)
2021-09-01 14:59:04 +00:00
(identifier))
(binary_operator
(identifier)
2021-09-25 00:23:37 +00:00
(identifier))
(binary_operator
(identifier)
(identifier))
(call
(identifier)
(arguments
(unary_operator
(identifier))))
(call
(identifier)
(arguments
(unary_operator
(call
(identifier)
(arguments
(unary_operator
(identifier))))))))
2021-09-01 14:59:04 +00:00
=====================================
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))))
2021-09-28 15:26:43 +00:00
=====================================
[field names]
=====================================
a + b
@a
---
(source
(binary_operator
left: (identifier)
right: (identifier))
(unary_operator
operand: (identifier)))