1
0
dust/tree-sitter-dust/corpus/functions.txt

234 lines
5.8 KiB
Plaintext
Raw Permalink Normal View History

2023-10-31 19:21:13 +00:00
================================================================================
2023-12-12 23:21:16 +00:00
Anonymous Function
2023-10-31 19:21:13 +00:00
================================================================================
2023-12-31 19:04:10 +00:00
() <str> { "Hiya" }
2023-10-31 19:21:13 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(statement
2023-12-02 03:54:25 +00:00
(expression
(value
(function
(type_specification
2023-12-12 23:21:16 +00:00
(type))
2023-12-02 03:54:25 +00:00
(block
(statement
(expression
(value
(string))))))))))
================================================================================
2023-12-30 01:14:03 +00:00
Function Assignment
2023-12-02 03:54:25 +00:00
================================================================================
2023-12-30 01:14:03 +00:00
foobar = (x <int>, y <int>) <int> {
2023-12-12 23:21:16 +00:00
x + y
}
2023-12-02 03:54:25 +00:00
--------------------------------------------------------------------------------
(root
(statement
(assignment
2023-11-11 01:44:03 +00:00
(identifier)
2023-12-02 03:54:25 +00:00
(assignment_operator)
(statement
(expression
(value
(function
(identifier)
(type_specification
2023-12-12 23:21:16 +00:00
(type))
(identifier)
(type_specification
2023-12-12 23:21:16 +00:00
(type))
(type_specification
2023-12-12 23:21:16 +00:00
(type))
2023-12-02 03:54:25 +00:00
(block
(statement
(expression
2023-12-12 23:21:16 +00:00
(math
(expression
(identifier))
(math_operator)
(expression
(identifier)))))))))))))
2023-10-31 22:18:39 +00:00
2023-10-31 19:21:13 +00:00
================================================================================
2023-12-30 01:14:03 +00:00
Identifier Function Call
2023-10-31 19:21:13 +00:00
================================================================================
2023-12-30 01:14:03 +00:00
foobar("Hiya")
2023-10-31 19:21:13 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(statement
(expression
(function_call
(function_expression
2023-12-02 07:34:23 +00:00
(identifier))
2023-11-11 01:44:03 +00:00
(expression
(value
(string)))))))
================================================================================
2023-12-30 01:14:03 +00:00
Index Function Call
================================================================================
2023-12-30 01:14:03 +00:00
foo:bar("Hiya")
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(function_expression
(index
(index_expression
(identifier))
(index_expression
(identifier))))
(expression
(value
(string)))))))
2023-12-30 01:14:03 +00:00
================================================================================
Double Function Call
================================================================================
foobar()("Hiya")
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(function_expression
(function_call
(function_expression
(identifier))))
(expression
(value
2023-12-30 01:14:03 +00:00
(string)))))))
================================================================================
Anonymous Function Call
================================================================================
(msg <str>) <str> { msg } ("Hiya");
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(function_expression
2024-01-01 09:59:27 +00:00
(value
(function
(identifier)
(type_specification
2024-01-01 09:59:27 +00:00
(type))
(type_specification
2024-01-01 09:59:27 +00:00
(type))
(block
(statement
(expression
(identifier)))))))
(expression
(value
(string)))))))
2023-10-31 19:21:13 +00:00
================================================================================
Complex Function Call
2023-10-31 19:21:13 +00:00
================================================================================
2023-12-30 01:14:03 +00:00
foobar(
"hi"
42
2023-11-28 16:01:38 +00:00
{
x = 1
y = 2
2023-11-28 16:01:38 +00:00
}
)
2023-10-31 19:21:13 +00:00
--------------------------------------------------------------------------------
(root
2023-11-11 01:44:03 +00:00
(statement
(expression
(function_call
(function_expression
2023-12-02 07:34:23 +00:00
(identifier))
2023-11-11 01:44:03 +00:00
(expression
(value
(string)))
(expression
(value
(integer)))
(expression
(value
(map
(identifier)
(statement
(expression
(value
(integer))))
(identifier)
(statement
(expression
(value
(integer)))))))))))
2023-12-15 22:27:29 +00:00
================================================================================
Callback Function Call
================================================================================
2023-12-30 01:14:03 +00:00
x(() <bool> { true })
2023-12-15 22:27:29 +00:00
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(function_expression
2023-12-15 22:27:29 +00:00
(identifier))
(expression
(value
(function
(type_specification
2023-12-15 22:27:29 +00:00
(type))
(block
(statement
(expression
(value
(boolean))))))))))))
================================================================================
Nested Function Call
================================================================================
2023-12-30 01:14:03 +00:00
from_json(read('file.json'))
--------------------------------------------------------------------------------
(root
(statement
(expression
(function_call
(function_expression
2024-01-01 09:59:27 +00:00
(identifier))
(expression
(function_call
(function_expression
2024-01-01 09:59:27 +00:00
(identifier))
(expression
(value
(string)))))))))