tree-sitter-elixir/test/corpus/term/struct.txt

240 lines
3.5 KiB
Plaintext
Raw Normal View History

2021-09-01 14:59:04 +00:00
=====================================
empty
=====================================
%User{}
---
(source
(map
(struct
(alias))))
=====================================
from keywords
=====================================
%User{a: 1, b: 2}
---
(source
(map
(struct
(alias))
(map_content
(keywords
(pair
2021-09-28 14:00:35 +00:00
(keyword)
2021-09-01 14:59:04 +00:00
(integer))
(pair
2021-09-28 14:00:35 +00:00
(keyword)
2021-09-01 14:59:04 +00:00
(integer))))))
=====================================
from arrow entries
=====================================
%User{:a => 1, "b" => 2, c => 3}
---
(source
(map
(struct
(alias))
(map_content
(binary_operator
2021-09-28 14:00:35 +00:00
(atom)
2021-09-01 14:59:04 +00:00
(integer))
(binary_operator
(string
2021-09-28 14:00:35 +00:00
(quoted_content))
2021-09-01 14:59:04 +00:00
(integer))
(binary_operator
(identifier)
(integer)))))
=====================================
from both arrow entries and keywords
=====================================
%User{"a" => 1, b: 2, c: 3}
---
(source
(map
(struct
(alias))
(map_content
(binary_operator
(string
2021-09-28 14:00:35 +00:00
(quoted_content))
2021-09-01 14:59:04 +00:00
(integer))
(keywords
(pair
2021-09-28 14:00:35 +00:00
(keyword)
2021-09-01 14:59:04 +00:00
(integer))
(pair
2021-09-28 14:00:35 +00:00
(keyword)
2021-09-01 14:59:04 +00:00
(integer))))))
=====================================
trailing separator
=====================================
%User{"a" => 1,}
---
(source
(map
(struct
(alias))
(map_content
(binary_operator
(string
2021-09-28 14:00:35 +00:00
(quoted_content))
2021-09-01 14:59:04 +00:00
(integer)))))
=====================================
update syntax
=====================================
%User{user | name: "Jane", email: "jane@example.com"}
%User{user | "name" => "Jane"}
---
(source
(map
(struct (alias))
(map_content
(binary_operator
(identifier)
(keywords
(pair
2021-09-28 14:00:35 +00:00
(keyword)
2021-09-01 14:59:04 +00:00
(string
2021-09-28 14:00:35 +00:00
(quoted_content)))
2021-09-01 14:59:04 +00:00
(pair
2021-09-28 14:00:35 +00:00
(keyword)
2021-09-01 14:59:04 +00:00
(string
2021-09-28 14:00:35 +00:00
(quoted_content)))))))
2021-09-01 14:59:04 +00:00
(map
(struct
(alias))
(map_content
(binary_operator
(identifier)
(binary_operator
(string
2021-09-28 14:00:35 +00:00
(quoted_content))
2021-09-25 00:23:37 +00:00
(string
2021-09-28 14:00:35 +00:00
(quoted_content)))))))
2021-09-01 14:59:04 +00:00
=====================================
unused struct identifier
=====================================
%_{}
---
(source
(map
(struct
(identifier))))
2021-09-01 14:59:04 +00:00
=====================================
matching struct identifier
=====================================
%name{}
---
(source
(map
(struct
(identifier))))
=====================================
pinned struct identifier
=====================================
%^name{}
---
(source
(map
(struct
(unary_operator
(identifier)))))
=====================================
with special identifier
=====================================
%__MODULE__{}
%__MODULE__.Child{}
---
(source
(map
(struct
(identifier)))
2021-09-01 14:59:04 +00:00
(map
(struct
(dot
(identifier)
2021-09-01 14:59:04 +00:00
(alias)))))
2021-09-25 00:23:37 +00:00
=====================================
with atom
=====================================
%:"Elixir.Mod"{}
---
(source
(map
(struct
2021-09-28 14:00:35 +00:00
(quoted_atom
(quoted_content)))))
2021-09-25 00:23:37 +00:00
=====================================
with call
=====================================
%fun(){}
%Mod.fun(){}
%fun.(){}
---
(source
(map
(struct
(call
(identifier)
(arguments))))
(map
(struct
(call
(dot
(alias)
(identifier))
(arguments))))
(map
(struct
(call
(dot
(identifier))
(arguments)))))