tree-sitter-elixir/test/corpus/integration/kernel.txt

138 lines
2.5 KiB
Plaintext

=====================================
for / enumerable
=====================================
for n <- [1, 2], do: n * 2
---
(source
(call
(identifier)
(arguments
(binary_operator
(identifier)
(list
(integer)
(integer)))
(keywords
(pair
(keyword
(atom_literal))
(binary_operator
(identifier)
(integer)))))))
=====================================
for / enumerable / with options and block
=====================================
for line <- IO.stream(), into: IO.stream() do
String.upcase(line)
end
---
(source
(call
(identifier)
(arguments
(binary_operator
(identifier)
(call
(dot
(alias)
(identifier))
(arguments)))
(keywords
(pair
(keyword
(atom_literal))
(call
(dot
(alias)
(identifier))
(arguments)))))
(do_block
(call
(dot
(alias)
(identifier))
(arguments
(identifier))))))
=====================================
for / binary
=====================================
for <<c <- " hello world ">>, c != ?\s, into: "", do: <<c>>
---
(source
(call
(identifier)
(arguments
(bitstring
(binary_operator
(identifier)
(string
(string_content))))
(binary_operator
(identifier)
(char))
(keywords
(pair
(keyword
(atom_literal))
(string))
(pair
(keyword
(atom_literal))
(bitstring
(identifier)))))))
=====================================
for / reduce
=====================================
for x <- [1, 2, 1], reduce: %{} do
acc -> Map.update(acc, x, 1, & &1 + 1)
end
---
(source
(call
(identifier)
(arguments
(binary_operator
(identifier)
(list
(integer)
(integer)
(integer)))
(keywords
(pair
(keyword
(atom_literal))
(map))))
(do_block
(stab_clause
(arguments
(identifier))
(body
(call
(dot
(alias)
(identifier))
(arguments
(identifier)
(identifier)
(integer)
(unary_operator
(binary_operator
(unary_operator
(integer))
(integer))))))))))